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

Home » Public Forums » archive » point_lun question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
point_lun question [message #17600] Mon, 01 November 1999 00:00
Frank[1] is currently offline  Frank[1]
Messages: 2
Registered: November 1999
Junior Member
Hi,
I have a data file with several measurements separated by some header
lines followed by data points. The whole file containes many
measurements. So I want to write a procedure, that reads the header and
the position of the file pointer at the end of the header and returns
this in a structure for further data processing.
Actually the routine finds the header, however, point_lun returns the
'correct' value only for the first header. If I check the second
position of the pointer using an hexditor the positions are not correct.
Whats wrong ? Do I use the wrong data type

I have added some code below:

function rd_data_header
current_line=""
count=0

filen=pickfile()
openr,unit,filen,/get_lun

while not (EOF(unit)) do begin
readf,unit,current_line
if (strpos(current_line,'#S ') eq 0) then begin
current_pos=fstat(unit)

if (count=0) then begin
result_header=current_line
result_pos=current_pos.cur_ptr
count=1
endif
if (count=1) then begin
tmp=strarr(size(result_header,/n_elements)+1) ; increase array size
tmp_pos=lon64arr(size(result_pos,/n_elements)+1) ; increase array size

tmp[0:size(result_header,/n_elements)-1]=result_header ; save obtained
headers
tmp_pos[0:size(result_pos,/n_elements)-1]=result_pos ; save obtained
positions

tmp[size(result_header,/n_elements)]=current_line; set last element
tmp_pos[size(result_pos,/n_elements)]=current_pos.cur_ptr; set last
element

result_header=tmp
result_pos=tmp_pos ; set tmp vars to current result
endif

endif

endwhile
free_lun,unit
result={header:result_header, position:result_pos}
return,result
end

Thanks, Frank
[Message index]
 
Read Message
Previous Topic: plot object
Next Topic: Re: Calling procedures from strings

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

Current Time: Sat Oct 11 06:52:21 PDT 2025

Total time taken to generate the page: 1.92131 seconds