file reading problem
- From: Bart Vandewoestyne <MyFirstName.MyLastName@xxxxxxxxxx>
- Date: Fri, 9 Sep 2005 15:46:00 +0000 (UTC)
I feel silly... i must have been staring at this for too long but
i cannot see the problem... I am trying to read the first line of
a text file to do some processing on it... I'm doing something
like the following:
...
character(len=*), intent(in) :: pointset_file
...
integer(kind=i4b), parameter :: max_chars = 100
integer(kind=i4b) :: my_unit
character(len=max_chars) :: line
integer(kind=i4b) :: ios
...
call get_unit(my_unit)
open(unit=my_unit, file=pointset_file, iostat=ios, status="old", &
access="sequential", action="read")
if (ios == 0) then
write(unit=*, fmt="(A)") "ERROR: could not open file "//pointset_file
end if
read (unit=my_unit, fmt="(A)", iostat=ios) line
if (ios /= 0) then
print *, "ERROR"
end if
print *, "line = ", line
...
Opening the file goes without problems, but reading the first
line of the file and trying to put the content in `line' always
seems to give errors because `ios' is nonzero and the content of
`line' is not the first line of my file.
What am i overlooking here? I've been staring at this for too
long now...
Regards,
Bart
--
"Share what you know. Learn what you don't."
.
- Follow-Ups:
- Re: file reading problem
- From: Richard E Maine
- Re: file reading problem
- From: [JvO]
- Re: file reading problem
- From: *** Hendrickson
- RE: file reading problem
- From: meek
- Re: file reading problem
- Prev by Date: Re: collective nouns -- Re: Optimal programming advice
- Next by Date: Re: file reading problem
- Previous by thread: Access violation after nullifiying and again allocating pointer
- Next by thread: RE: file reading problem
- Index(es):