
;
; Copyright (c) 1996, Forschungszentrum Juelich GmbH ICG-1
; All rights reserved.
; Unauthorized reproduction prohibited.
; This software may be used, copied, or redistributed as long as it is not
; sold and this copyright notice is reproduced on each copy made.  This
; routine is provided as is without any express or implied warranties
; whatsoever.
;+
; NAME:
;  filesize
;
; PURPOSE:
;   The result of this function is the bytelength of an ascii file
;
; CATEGORY:
;   DATAFILES/FILE
;
; CALLING SEQUENCE:
;   Result=filesize(file_name)
;
; INPUTS:
;   file_name: the name of an ascii file
;
; OUTPUTS:
;	This function returns the number of bytes of an ascii file
;
; EXAMPLE:
;   Result=filesize('test.asc')
;
; MODIFICATION HISTORY:
;   Written by:	R.Bauer (ICG-1), Oct. 1996
;-

FUNCTION filesize, filename

if n_params() lt 1   then begin
      help:help,call=call
      help_of_interest=within_brackets(call[0],brackets=['<','('])
      message,help_calling_sequence(help_of_interest),/cont
      return,-1
      help_open: message, 'File: '+filename+' not found',/cont
      return,-1
   endif




   OPENR, lun, filename, /GET_LUN,error=err
   IF err  NE 0 THEN GOTO, help_open
   stats = FSTAT(lun)
   FREE_LUN, lun

   RETURN, stats.size
END



