RE: noob question re: space delimited input
- From: meek@xxxxxxxxxxxxxxx
- Date: 26 NOV 06 03:58:36 GMT
In a previous article, nichevo@xxxxxxxxx wrote:
I am probably overlooking something very simple. I just don't see what
it is.
I have a test input file that called 'input.txt' containing:
1111 2222 3333
1111. 2222. 3333.
and a program:
...
open (unit=1, file='input.txt')
...
do while (length .NE. maxSize)
read (1, *, IOSTAT=ios) a, b, c
if (ios .EQ. -1) exit
length = length + 1
print*, a, b, c
end do
It reads the appropriate amount of entries before iostat returns '-1'
but my output looks like:
16777216 0 0
37810344 0 0
If I change the the type of a, b, and c to real, I get one wacky real
number and two 0's per line.
It is obviously not reading space delimited. I have been fiddling with
it for way too long now. I would appreciate some advice.
Thanks
C watcom fortran 77 v10.9 (I think)
real*4 a,b,c
open(20,file='tt.tst',form='formatted')
read(20,*)a,b,c
print*,a,b,c
stop
end
works
(i.e. o/p = 11111.00000 22222.00000 33333.0000 )
where tt.tst =
11111 22222 33333
If the i/p file has decimal pts. you'll probably have
trouble if you type a,b,c as integer.
www.openwatcom.org open source program ; free download
Chris
.
- References:
- noob question re: space delimited input
- From: nichevo
- noob question re: space delimited input
- Prev by Date: Re: noob question re: space delimited input
- Next by Date: Re: noob question re: space delimited input
- Previous by thread: Re: noob question re: space delimited input
- Next by thread: Absoft f77 compiler error
- Index(es):