function read_dem2str, filename ;filename='U304_011228_212145_AR_top.lines' openr, unit, filename, /get_lun, ERROR = err ; If err is nonzero, something happened. Print the error message to ; the standard error file (logical unit -2): IF (err NE 0) then begin PRINTF, -2, !ERROR_STATE.MSG return, {name:'U304_000000_000000.dem',type:'X',class:'0',time:0} endif s='' struct={name:'U304_000000_000000.dem',type:'X',class:0,time:0} & j=0 while not eof(unit) do begin s='' readf, unit, s, format='(A)' s=strtrim(s) if strpos(s,";") eq -1 then begin s=strsplit(s," ",/extract) if j eq 0 then struct={name:s[0],type:s[1],class:fix(s[2]),time:fix(s[3])} $ else struct=[struct,{name:s[0],type:s[1],class:fix(s[2]),time:fix(s[3])}] j=j+1 endif endwhile close , unit & free_lun, unit print, "%read_dem2str: File - ", filename, format='(A,A)' print, "%read_dem2str: ", j, " lines", format='(A,I3,A)' return, struct end