Home »
Public Forums »
archive »
Problem reading data from stdin using EOF(0) in version 6.0 and 7.0
Problem reading data from stdin using EOF(0) in version 6.0 and 7.0 [message #64420] |
Sun, 21 December 2008 03:48 |
kiwing.to@gmail.com
Messages: 2 Registered: December 2008
|
Junior Member |
|
|
I am not sure if the EOF() function in IDL version newer than 5.2
really has some problem or some setting has to be adjusted.
I just want to read data from the stdin and automatically stop at
the end-of-file. The following codes work for version 5.2 but not
for version 6.0 nor version 7.0.
Just want to know if anyway around it ?
#######################
;--- test_eof.pro -----------------
pro test_eof
a=float(1)
while not eof(0) do begin
read, a
print, a
endwhile
end
;---- end of 'test_eof.pro' -----
#######################
;---- test_eof.idl ----------------
.compile test_eof
.run test_eof
exit
;---- end of 'test_eof.idl' ------
#######################
When I ran it using "idl test_eof.idl"
I got error at the end of my input.
############################################################ #
IDL Version 7.0 (linux x86 m32). (c) 2007, ITT Visual Information
Solutions
Installation number: 60188.
Licensed for use by: Academia Sinica
% Compiled module: $MAIN$.
% Compiled module: $MAIN$.
: 1
1.00000
: 2
2.00000
: ^D
% READ: Error encountered reading from file. Unit: 0
File: <stdin>
% Execution halted at: $MAIN$ 3 /home/ericto/test_eof.pro
############################################################ ##
|
|
|
Current Time: Thu Oct 09 07:28:54 PDT 2025
Total time taken to generate the page: 0.48053 seconds