Re: Problem using ReadS to read a long string [message #75954] |
Wed, 04 May 2011 16:38 |
Evan
Messages: 2 Registered: May 2011
|
Junior Member |
|
|
On May 4, 5:07 pm, Paulo Penteado <pp.pente...@gmail.com> wrote:
> On May 4, 8:01 pm, Evan <emt...@gmail.com> wrote:
>
>
>
>> I've spent quite a while on this small problem to no avail. I have a
>> long formatted string that contains data that I need to access.
>> Unfortunately, when I try to format it with ReadS, I always get an
>> "end of input data encountered" error.
>
>> The strings look like this:
>
>> pg0953_ 0.36250 Lya -28 34108673 1108673 1 11 4 11 2
>> 65.7 13.0 73.4 13.9 e140m 18.8 6.2 13.305 0.101 -0.073 13.324
>> 0.078 -0.078 f0
>
>> And I'm using the following line of code to read it:
>
>> reads,input,root,z,ion,vthing,vaod,dvaod,vfit,dvfit,baod,dba od,bfit,dbfit,waod,dwaod,
>> $
>
>> wfit,dwfit,chan,wmin,snres,lnaod,dlnpaod,dlnmaod,lnfit,dlnpf it,dlnmfit,flag,
>> $
>> format='(A,F,A,I,I,I,I,I,I,I,I,I,F,F,F,F,A,F,F,F,F,F,F,F,F,A )'
>
>> I've never had to use ReadS before, so I'm wondering if I'm making
>> some really simple mistake about how it works. Any ideas?
>
> The problem is the "A" at the beginning. The string read into the
> first variable will gobble up everything, leaving nothing for the rest.
Thanks so much; that solved it!
|
|
|
Re: Problem using ReadS to read a long string [message #75955 is a reply to message #75954] |
Wed, 04 May 2011 16:07  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On May 4, 8:01 pm, Evan <emt...@gmail.com> wrote:
> I've spent quite a while on this small problem to no avail. I have a
> long formatted string that contains data that I need to access.
> Unfortunately, when I try to format it with ReadS, I always get an
> "end of input data encountered" error.
>
> The strings look like this:
>
> pg0953_ 0.36250 Lya -28 34108673 1108673 1 11 4 11 2
> 65.7 13.0 73.4 13.9 e140m 18.8 6.2 13.305 0.101 -0.073 13.324
> 0.078 -0.078 f0
>
> And I'm using the following line of code to read it:
>
> reads,input,root,z,ion,vthing,vaod,dvaod,vfit,dvfit,baod,dba od,bfit,dbfit,waod,dwaod,
> $
>
> wfit,dwfit,chan,wmin,snres,lnaod,dlnpaod,dlnmaod,lnfit,dlnpf it,dlnmfit,flag,
> $
> format='(A,F,A,I,I,I,I,I,I,I,I,I,F,F,F,F,A,F,F,F,F,F,F,F,F,A )'
>
> I've never had to use ReadS before, so I'm wondering if I'm making
> some really simple mistake about how it works. Any ideas?
The problem is the "A" at the beginning. The string read into the
first variable will gobble up everything, leaving nothing for the rest.
|
|
|