home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a013 / 1.ddi / SOURCE.EXE / F_FISIZE.PRG < prev    next >
Encoding:
Text File  |  1991-01-25  |  575 b   |  25 lines

  1. *****************************************************************
  2. FUNCTION FILESIZE (file_name)
  3. *****************************************************************
  4.  
  5. * Returns size of a file in bytes
  6.  
  7. * Copyright(c) 1991 -- James Occhiogrosso
  8.  
  9. # include "fileio.ch"
  10. # translate F_LEN(<n>)  => FSEEK(<n>, FS_SET, FS_END)
  11.  
  12. LOCAL handle := file_size := 0
  13.  
  14. * Open the file and get a handle
  15. handle = FOPEN(file_name, 0)
  16.  
  17. * Get file size or -1 on error
  18. file_size = IF(handle != -1, F_LEN(handle), -1)
  19.  
  20. * Close file and return
  21. FCLOSE(handle)
  22.  
  23. RETURN file_size
  24.  
  25.