unexpected EOF? [message #19704] |
Wed, 12 April 2000 00:00 |
Kyung Byun
Messages: 3 Registered: April 2000
|
Junior Member |
|
|
Hi--
I have a function that is supposed to take a text file and remove the
top few lines and bottom lines (I'm trying to extract the middle bunch
of lines in the text...the files I'm feeding this function are all
basically the same format). I'm running the program and on the
readf, ... line I'm getting the following message:
% READF: End of file encountered. Unit: 101, File: HEFTmimic2.ef
% Execution halted at: STRIP 27 /data/mlf2/area/2conefolder/oplot_eax.pro
% $MAIN$ 79 /data/mlf2/area/2conefolder/oplot_eax.pro
ie, IDL is telling me that the file I'm feeding into it ('HEFTmimic2.ef')
has an EOF at the beginning of the file (?!) that is preventing it from
going further. The file 'HEFTmimic2.ef' is not empty, so I don't know
what the message means.
Can anyone help me out? The function in question, strip, is below (btw,
the function wc(...) does a line count and returns an integer; it works).
Thanks!
Kyung
;strip headers and footers from .ef files
FUNCTION strip, filename
alllines = wc(filename)
allarray = strarr(2,alllines)
openr, u, filename, /GET_LUN
readf, u, allarray
close, u
FREE_LUN, u
i = 0
while NOT strpos(allarray[1,i], 'ENERGY') do begin
i = i + 1
temp = allarray[1,i]
endwhile
j = 0
while strpos(allarray[1,i], '10') do j = j + 1
result = allarray(*,i+1:j+1)
return, result
end
--
*****Kyung Wha Byun******************************************************
EMAIL kbyun@fas.harvard.edu,
kbyun@cfa.harvard.edu
*****IN BOSTON (present)*********************PERMANENT (in New York)*****
ADDRESS 249 Pforzheimer Mail Center 4 Hudson River Road
Cambridge, MA 02138-7529 Bronx, NY 10471-1227
TEL (617) 493-6193 (h) (718) 543-3067 (h)
ROOM Holmes 308
************************************************************ *************
|
|
|