Re: Problem reading data from a file (encounter EOF after second last record)
- From: Arjen Markus <arjen.markus@xxxxxxxxxx>
- Date: Tue, 29 Jan 2008 02:11:44 -0800 (PST)
On 29 jan, 09:28, nure...@xxxxxxxxx wrote:
Hi Everybody,
I am reading data from a file. I know the number of records in the
file and can read all the records except for the last. Using IOSTAT
in the READ statement shows that EOF is encountered after reading the
second last record. I am baffled a bit. I think it has to do something
with the program which created the datafile in the first place, but I
do not want to touch that program as far as possible. Could anybody
pull me out of the problem.
(for example, following is the structure of my datafile. I can read
the second last line, but not the last)
0.00000000000000E+000 1 5.00E-008
5.00000000000000E-004 2 5.90E-008
1.08988019155737E-003 3 6.96E-008
1.78579747234089E-003 4 8.21E-008
2.60681311013423E-003 5 9.69E-008
3.57541483352048E-003 6 1.14E-007
4.71813277378826E-003 7 1.35E-007
6.06626612879065E-003 8 1.59E-007
7.65674045217803E-003 9 1.88E-007
9.53311904927169E-003 10 2.21E-007
1.17467961818472E-002 11 2.61E-007
Regards,
Nure
Check that the file ends with a proper end-of-line character sequence.
Some text editors consider end-of-line characters as
line separators and leave out the last end-of-line.
(Most notorious in this regard: notepad.exe on Windows)
For Fortran programs this poses a significant problem, as the
file appears to be corrupted (in my opinion it actually is ;)).
Regards,
Arjen
.
- Follow-Ups:
- References:
- Prev by Date: Re: locate a value in an array
- Next by Date: Re: large number with interger
- Previous by thread: Problem reading data from a file (encounter EOF after second last record)
- Next by thread: Re: Problem reading data from a file (encounter EOF after second last record)
- Index(es):