Bug in formatted read? [message #2515] |
Tue, 02 August 1994 00:33 |
landsman
Messages: 93 Registered: August 1991
|
Member |
|
|
I'm not sure if the following should be called a bug, but it certainly
has caused me a lot of trouble until I realized what was going on.
Normally, during a formatted read one gets an error "End of Input record
encountered" if the input line ends before all the variables have been read
in. But if one includes spaces ('X') in the read format, then IDL
blithely goes along filling the remaining variables with the last character
read. For example,
; IDL Version 3.6 (vms alpha)
a = '23.5'
reads,a,f='(f4.1,1x,f5.1,1x,f5.1)',x,y,z
print,x,y,z
; 23.5000 5.00000 5.00000
In this case, the string to be read contained data only for the first variable
X. So the next two variables were filled with the last character read
'5', and no error message was given. (I use READS here so I don't have
read from a file, but the same thing happens using READF.)
--Wayne Landsman landsman@stars.gsfc.nasa.gov
|
|
|