;----------- cut here ------------------- function example_read_poam2_dmp,file,data data={poam2_dmp_data} ;; open the file openr,lun,file,/get_lun,error=error if error ne 0 then begin Message,"Can't open " + file + " Aborting",/info return,0 endif ;; Find out how big the file is. ff = fstat(lun) ;; How big is the structure itself? nbytes = n_tags(data,/data_length) ;; Calculate dimension of array of structures nrecs = ff.size/nbytes data = replicate(data,nrecs) ;; Read the data readu,lun,data ;; close file, free lune close,lun free_lun,lun ;; Might address endian issues here, see swap_endian and swap_endian_in_place return,1 end ;--------------------------------------- ; ; Copyright 2007, by the California Institute of ; Technology. ALL RIGHTS RESERVED. United States Government ; Sponsorship acknowledged. Any commercial use must be ; negotiated with the Office of Technology Transfer at the ; California Institute of Technology. ; ; This software may be subject to U.S. export control ; laws. By accepting this software, the user agrees to ; comply with all applicable U.S. export laws and ; regulations. User has the responsibility to obtain export ; licenses, or other export authority as may be required ; before exporting such information to foreign countries or ; providing access to foreign persons.