Reading Tab Separated Files
From: Alan Ross (alan_at_rebeluk.com)
Date: 10/24/04
- Next message: HeartVFire: "Looking for an old Fortran book"
- Previous message: Dave Seaman: "Re: Installing g95 on OS X"
- Next in thread: Richard Maine: "Re: Reading Tab Separated Files"
- Reply: Richard Maine: "Re: Reading Tab Separated Files"
- Reply: Dan Tex1: "Re: Reading Tab Separated Files"
- Reply: James Van Buskirk: "Re: Reading Tab Separated Files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 24 Oct 2004 09:29:51 -0700
Dear All,
I am currently learning Fortran and am stuck on a problem. I have
scoured the web and this group for a solution but to no avail.
Hopefully someone would be able to point me in the right direction.
I am attempting to read in a formatted file of integer values
separated by tabs. There are three values per line. eg.
180 807 479
27 785 88
145 50 429
317 5 805
131 77 402
I am attempting to use the following code:
integer :: i1, i2, i3
open(unit = 10, file = "list.dat", form = "formatted", action =
"read")
do
read(10, *) i1, i2, i3
write(*,*) i1, i2, i3
end do
close(10)
According to the postings in this group, the free form format * should
recognise the tabs as separating the integers (btw. I am using NAGware
F95 compiler). I get the error message "Invalid input for integer
editing"
I also experimented with format statements namely fmt="(i3, t5, i3,
t9, i3)" but since the number of integer characters before the tab
varies, I have problems. So it only outputs the first line and ignores
the rest.
Could anyone please help push me in the right direction. I have spent
days on this problem now.
Thanks,
Alan
- Next message: HeartVFire: "Looking for an old Fortran book"
- Previous message: Dave Seaman: "Re: Installing g95 on OS X"
- Next in thread: Richard Maine: "Re: Reading Tab Separated Files"
- Reply: Richard Maine: "Re: Reading Tab Separated Files"
- Reply: Dan Tex1: "Re: Reading Tab Separated Files"
- Reply: James Van Buskirk: "Re: Reading Tab Separated Files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|