Results 1 to 40 of 64

Thread: VB6 - Huge (>2GB) File I/O Class

Hybrid View

  1. #1

    Thread Starter
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: VB6 - Huge (>2GB) File I/O Class

    The error 45602 reports system error 32 as the reason. The system error 32 is ERROR_SHARING_VIOLATION ("The process cannot access the file because it is being used by another process."). I have no idea how the code you show can get this, since I don't see an open, just two CloseFile() calls.


    The other problems most likely come from trying to read a file actively being written, until EOF. Because the process logging to this file is still writing and has not set EOF yet by closing it or calling SetEOF there is no EOF to be detected.

    Perhaps it hangs waiting to read a new buffer of data, and then hangs again waiting for another after that, and so on.


    Basically, what you are trying to do is impractical. The only way I can imagine making it work at all probably requires the use of GetFileSize()/GetFileSizeEx() to figure out "where to call it quits" instead of relying on an EOF indication from the ReadFile() function. If you really need to do this you could probably rewrite the class to work that way.

    Note that you will never get all of the data though, only the part the logging process has flushed to disk. Even then the last "line" of text you retrieve will be an incomplete line most of the time, and you may even get back "garbage" for the part of the file that hasn't been flushed-to yet.

  2. #2
    Addicted Member
    Join Date
    Sep 2008
    Posts
    141

    Re: VB6 - Huge (>2GB) File I/O Class

    actually something like this works fine


    Open strFile For Binary As #intFile
    strText = String$(LOF(intFile), 32)
    Get #intFile, 1, strText
    Close #intFile

    strLine() = Split(strText, vbCrLf)
    lngLineCount = UBound(strLine)

    then I read the lines from the array.. later.. I read the lines starting at the last line I read based on that same array which is stored as a variable. I was just trying to see if I could get a little more speed using this method.

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