Re: Suppress return with readf ? [message #13602 is a reply to message #13409] |
Tue, 24 November 1998 00:00  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
John Kwiatkowski wrote:
> I have an ASCII data set that is giving me problems. I need to suppress
> the return when using readf since I only want to read in part of the
> line. Depending on the value of one of the fields there may be more
> info to read on that line. Anyone know how to stop readf from moving
> to the next line?
>
> Here is an example of 2 lines in the data file
> 0 58 2 94 2 0 0 0 0
> 0 57 7 85 44 0 0 0 2 0 0 0 2 0 0 0
>
> The first line has the 9 fields that are on every line. Depending on the
> value of the 9th field there may be 7 more fields to read on that line.
>
> psuedo code:
> A ; structure with required 9 fields
> B ; structure with optional 7 fields
>
> readf, unit, A
> if (A.field9 neq 0) then
> readf, unit B
>
> After the first read the file pointer gets placed at the next line in
> the file. How do I suppress this?
>
> Thanks for any help
> John K.
If you do a byte read in like this you got no problems with the linefeed or
carriage return lindfeed
PRO x_test
a=0B
OPENU,10,'test.txt',/bin
READU,10,a
PRINT,STRING(a)
READU,10,a
PRINT,STRING(a)
READU,10,a
PRINT;STRING(a)
CLOSE,10
END
|
|
|