|
-
Apr 29th, 2006, 08:26 AM
#1
Thread Starter
New Member
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
-
Apr 29th, 2006, 10:21 PM
#2
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:
Get #n, , FileData
Close #n
[B]DoEvents[/B]
nLenFileData = Len(FileData)
Put #F, , nLenFileData
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|