Results 1 to 3 of 3

Thread: File size...

  1. #1

    Thread Starter
    Member sTyLeZ's Avatar
    Join Date
    Jan 2001
    Posts
    35
    Is there any *simple* way of getting a file's size, even if it is already open? I'm using this

    Code:
    Open f$ For Binary As #2
    Size(J) = LOF(2)
    Close #2
    But, I get "Error 55: File already open" when it comes across files that are in use. I've looked at the GetFileSize and GetFileSizeEx API calls, and examples of how to use them, and I really don't wanna go through that much work just to get the file's size. I've also looked at GetFileAttributes, but that doesn't look any simpler. Any ideas?
    Now the world is gone I'm just one...

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Ths can be done without any API function call.

    Code:
        Open "C:\pats.mdb" For Binary As #1
            MsgBox "(From Open File) File size is : " & LOF(1) & " bytes"
        Close #1
    
        MsgBox "(using FileLen function and file is closed) File size is : " & FileLen("C:\pats.mdb") & "bytes"

  3. #3

    Thread Starter
    Member sTyLeZ's Avatar
    Join Date
    Jan 2001
    Posts
    35
    Thanks.
    Now the world is gone I'm just one...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width