Announcement

Collapse
No announcement yet.

Comments for FileSize in source code forum

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Comments for FileSize in source code forum

    Function will return quad size of file or -1 if any error.
    PowerBASIC and related source code. Please do not post questions or discussions, just source code.


    Code:
    FUNCTION FileSize(BYVAL sFileName AS STRING) AS QUAD
      'Bytes = FileSize(sFileName)  returns file size or -1 if any error
     
      LOCAL FindData AS WIN32_FIND_DATA
      LOCAL hDir AS LONG
      hDir = FindFirstFile(BYVAL STRPTR(sFileName), FindData)
      IF hDir = -1 THEN  'if not found return -1
        FUNCTION = -1
      ELSE               'return number of bytes
        FindClose hDir
        'Thank you, Pierre Bellisle
        FUNCTION = MAK(QUAD, FindData.nFileSizeLow , FindData.nFileSizeHigh)
      END IF
    END FUNCTION
    Last edited by Mike Doty; 14 Apr 2009, 05:16 AM.
    The world is full of apathy, but who cares?
Working...
X