Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


  >  Docs Center  >  Libraries  >  ASTROLIB  >  GET_PIPE_FILESIZE

GET_PIPE_FILESIZE

GET_PIPE_FILESIZE

Name


      GET_PIPE_FILESIZE

Purpose


      Determine the number of bytes in a unit opened as a pipe with SPAWN

Explanation


      Reads into a buffer until the end of file is reached and then counts the
      number of bytes read. Needed because the fstat.size field is not
      automatically set for a unit opened as a pipe.

Calling Sequence


      GET_PIPE_FILESIZE,unit, nbytes_in_file, BUFFER =

Inputs


      unit - IDL unit number of a previously opened file. For example,
        an FPACK ( http://heasarc.gsfc.nasa.gov/fitsio/fpack/ ) compressed
        FITS file could be opened as follows:
        IDL> spawn,'funpack -S test.fits.fz', unit=unit

Outputs


      nbytes_in_file - Unsigned long64 integer giving number of bytes in
        the file.

Input Keyword Parameters


      BUFFER Integer giving number of bytes in the buffer. Default =
    . 1000000

Notes


      Unite must be opened prior to calling GET_PIPE_FILESIZE, and the number
      of bytes is counted from the current pointer position. The pointer is
      left at the end of the file upon return.

Procedures Used


    SETDEFAULTVALUE

Revision History


      Written, W. Landsman Adnet Dec 2010
On_error,2
compile_opt idl2
nbytes = 0ULL
setdefaultvalue, buffer, 1000000
ON_IOerror,Done
b= bytarr(buffer,/noz)
while 1 do begin
  readu,unit,b
  nbytes += buffer
endwhile
one:
On_IOError, null
nbytes += (fstat(unit)).transfer_count

Return


end



© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us