Home > Archive > Fortran > March 2008 > Question on reads
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| sara_patty 2008-03-24, 7:27 pm |
| I want to read the the two integers in the line shown. Is there a
simple way to read this when the format is not fixed [input user
dependent]
$2,1 1 8 3600.0 2456.40 0 1456.29
$2,1 1 13 3104.93 86. - 1323.07 47.55
In the first case $ is in column 1 and in the second case in column 2.
I want to get the integers 1 and 8 and 1 and 13 in that line.
Thanks for any help.
| |
|
| sara_patty wrote:
> I want to read the the two integers in the line shown. Is there a
> simple way to read this when the format is not fixed [input user
> dependent]
>
> $2,1 1 8 3600.0 2456.40 0 1456.29
>
> $2,1 1 13 3104.93 86. - 1323.07 47.55
>
>
> In the first case $ is in column 1 and in the second case in column 2.
> I want to get the integers 1 and 8 and 1 and 13 in that line.
> Thanks for any help.
List-directed input should work ok...
! A dummy character variable; make as long as need for longest input
character(len=4):: chrdum
! two integer variables plus one placeholder to "skip" the unwanted
integer :: a, b, dum ...
open(11, file='yourinput.dat')
read(11,*) chrdum, dum, a, b
--
|
|
|
|
|