FUNCTION hdr_info,fname ;+ ;info=hdr_info(fname) returns a structure with a field and ;value for each line of the file that contains an = sign. ; ;EXAMPLE ;Suppose that file 'fred.hdr' contains the lines ; ;ENVI ;DESCRIPTION = {SWIR image} ;SAMPLES = 640 ;LINES = 510 ; ;Then info=hdr_info('fred.hdr') would produce a structure ;info with info.DESCRIPTION='{SWIR image}', info.SAMPLES='640' ;and info.LINES=510. ; ;The program only pays attention to lines that contain = . ;Everything after = is the value. ; ;H. Rhody ;June 28, 2004 ;- openr,lun,fname,/get_lun p={control_file:fname} s='' WHILE NOT EOF(lun) DO BEGIN readf,lun,s print,s n=STRPOS(s,'=') IF n GE 0 THEN BEGIN name=STRTRIM(STRMID(s,0,n),2) value=STRTRIM(STRMID(s,n+1),2) p=Create_Struct(p,name,value) ENDIF ENDWHILE free_lun,lun return,p END