comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Suppress return with readf ?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Suppress return with readf ? [message #13409] Wed, 04 November 1998 00:00 Go to next message
John Kwiatkowski is currently offline  John Kwiatkowski
Messages: 4
Registered: May 1998
Junior Member
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.
Re: Suppress return with readf ? [message #13602 is a reply to message #13409] Tue, 24 November 1998 00:00 Go to previous message
R.Bauer is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: TV/postscript problem
Next Topic: Dumb Dumb Question

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 01:16:06 PDT 2025

Total time taken to generate the page: 0.96273 seconds