Results 1 to 2 of 2

Thread: cant read large file

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    4

    Talking cant read large file

    Hi all,
    i am writting an application where i need to read files from different locations of hard disk.My application can read files of size upto 10 MB but fails to read if the file size is more than that and my system hangs. I am using win98 and VB 6.0.

    PLz help me to work around.
    ####################################################
    ########this is the portion of the code where the system hangs#######

    F = FreeFile
    Open sArchiv For Binary As #F
    Put #F, , nFiles
    For i = 1 To nFiles
    nLenFileName = Len(File(i))
    Put #F, , nLenFileName
    Put #F, , File(i)
    n = FreeFile
    FileNameFull1 = sPath + File(i)
    FileNameFull2 = Left(FileNameFull1, InStrR(FileNameFull1, "\"))
    FileNameFull3 = Right(FileNameFull1, Len(FileNameFull1) - InStrR(FileNameFull1, "\"))
    Open sPath + File(i) For Binary As #n
    FileData = Space$(LOF(n))
    Get #n, , FileData
    Close #n
    nLenFileData = Len(FileData)
    Put #F, , nLenFileData
    Put #F, , FileData
    DoEvents
    Next i
    Close #F


    ####################################################
    ####################################################

    Thanks

  2. #2
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: cant read large file

    Please use VBCODE tags for your code.

    Also use

    Open sPath + File(i) For Binary Access Read Shared As #n

    I believe a read only files transfers faster because no locks are needed.

    Unfortunately reading large files will depend on your computer, memory and hard disk speeds. I would also suggest placing a DoEvents here
    VB Code:
    1. Get #n, , FileData
    2. Close #n
    3. [B]DoEvents[/B]
    4. nLenFileData = Len(FileData)
    5. Put #F, , nLenFileData
    6. Put #F, , FileData

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