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

Home » Public Forums » archive » Reading in to array elements from a file.
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
Reading in to array elements from a file. [message #12274] Wed, 22 July 1998 00:00
nrogers is currently offline  nrogers
Messages: 1
Registered: July 1998
Junior Member
I wonder if anyone could solve the following mystery for me.
I am trying to read in *individual* array elements from a file using
the readf procedure. I have an input file called test.txt containing
(say)
1 2 3 4 5 6
and the following IDL procedure to read them in and print them out
again.
;------------------
pro test
array=intarr(6)
infile='test.txt'
openr,inlun,infile,/get_lun
for cnt=0,5 do begin
readf,inlun,array[cnt]
endfor
close,inlun
free_lun,inlun
print,array
return
end
;-----------------
Unfortunately, although no compile or run-time errors are encountered,
nothing is assigned to the array elements and the file pointer stays
at the beginning of the file. The output is then,
0 0 0 0 0 0
Why is this?
Thanks for your help.

Neil.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Reading in to array elements from a file.
Next Topic: Re: getting data from a pointer

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

Current Time: Fri Oct 10 13:42:07 PDT 2025

Total time taken to generate the page: 1.20563 seconds