Index: trunk/Ohana/src/gastro2/src/rtext.c
===================================================================
--- trunk/Ohana/src/gastro2/src/rtext.c	(revision 3413)
+++ trunk/Ohana/src/gastro2/src/rtext.c	(revision 3520)
@@ -5,5 +5,5 @@
 # define BLOCK 1000
 
-StarData *rtext (char *filename, Header *header, int *nstars) {
+StarData *rtext (FILE *f, int *nstars) {
 
   FILE *f;
@@ -13,21 +13,7 @@
   StarData *stars;
 
-  /* allocate space for stars */
-  NSTARS = -1;
-  fits_scan (header, "NSTARS", "%d", 1, &NSTARS);
-  if (NSTARS == -1) {
-    fprintf (stderr, "ERROR: failed to find NSTARS\n");
-    exit (1);
-  }
+  NSTARS = *nstars;
   ALLOCATE (stars, StarData, MAX (NSTARS, 1));
   Nbytes = NSTARS*BYTES_STAR;
-
-  /* open file for stars */
-  f = fopen (filename, "r");
-  if (f == NULL) {
-    fprintf (stderr, "ERROR: can't open file to load stars\n");
-    exit (1);
-  }
-  fseek (f, header[0].size, SEEK_SET); 
 
   N = Nstars = 0;
@@ -52,5 +38,4 @@
   }
   free (buffer);
-  fclose (f);
  
   if (Nstars != NSTARS) {
