Skipping a line while reading a file. [message #15558] |
Thu, 20 May 1999 00:00 |
DBorland
Messages: 10 Registered: March 1999
|
Junior Member |
|
|
Greetings,
I am trying to read in some data from a file, and there is a blank line in
the file. This would not be a problem if the next line I needed to read was
not a string. Is there any way to have idl skip a line while reading a
file?
Here is an example of the data file:
0 0x01c34f0c 0.241067 0 3.03887 0.00028854
0.16204 -0.154521 0.0120137
0.729378 -0.679382 0.0803007
0x01c34738 0x01c4bc3c 0x01c4bfe4 0x01c4bdc4 0x01c4c580 0x01c4c16c
1 0x01c4c470 0.218461 0 3.06712 0.000293033
0.165022 -0.149886 0.0240568
0.730279 -0.678342 0.080902
0x01c4bc3c 0x01c4be10 0x01c4bfe4 0x01c4c2c8 0x01c4c424 0x01c4c580
2 0x01c4c314 0.207737 0 0.236737 0.000292291
0.158674 -0.151057 0.0477739
0.710881 -0.661519 0.238832
0x01c2f4f4 0x01c4bfe4 0x01c4be10 0x01c4c120 0x01c4c424 0x01c4bf98
: : : : : :
: : : : : :
: : : : : :
and I am reading it in with the following:
for i = 0, n-1 do begin
readf,lun,index,hex_address,angle,magnitude,potential,area
readf,lun,location
readf,lun,outward_normal
readf,lun,address
: : :
endfor
The first three lines work fine for the first set of data, but then address
returns ''. That makes it to where the next time I go through this loop,
the stuff on the first line get the long string, and it throws everything
off.
If I put in an integer place holder, like this:
for i = 0, n-1 do begin
readf,lun,index,hex_address,angle,magnitude,potential,area
readf,lun,location
readf,lun,outward_normal
readf,lun,integer_place_holder
readf,lun,address
: : :
endfor
then the loop works ok each time around, and all the fields,except address,
are read in properly. Address is still blank.
I think that if I could make it skip a line after it reads the
outward_normal, than I would be able to read the address in correctly.
Any clues?
David Borland
|
|
|