Teknikill
Dec 28th, 1999, 04:55 PM
I'm currently working on a file transfer program in vb. I have it working well, and I want to add the ability to resume a file.
I currently open the file For Binary Access Write As fileNum
and in the data arrivial event I have:
Dim data As String
sckReceive.GetData data
Put #fileNum, , data
'Update the progressbar
ect...
I send the file like this:
Dim hIn, fileLength, ret
Dim data As String
Dim blockSize As Long
blockSize = 2048
hIn = FreeFile
Open fileName For Binary Access Read As hIn
fileLength = LOF(hIn)
Do Until EOF(hIn)
If fileLength - Loc(hIn) <= blockSize Then _ blockSize = fileLength - Loc(hIn)
data = Space$(blockSize)
Get hIn, , data
sckSend.SendData data
sizeOfFileSent = sizeOfFileSent + blockSize
'Update progressbar
Loop
I need to know how to start reading a file from a certain byte, and to write starting at a certain byte or for append. Doesn't append add carriage returns and line feeds...
Any help is appreciated.
I currently open the file For Binary Access Write As fileNum
and in the data arrivial event I have:
Dim data As String
sckReceive.GetData data
Put #fileNum, , data
'Update the progressbar
ect...
I send the file like this:
Dim hIn, fileLength, ret
Dim data As String
Dim blockSize As Long
blockSize = 2048
hIn = FreeFile
Open fileName For Binary Access Read As hIn
fileLength = LOF(hIn)
Do Until EOF(hIn)
If fileLength - Loc(hIn) <= blockSize Then _ blockSize = fileLength - Loc(hIn)
data = Space$(blockSize)
Get hIn, , data
sckSend.SendData data
sizeOfFileSent = sizeOfFileSent + blockSize
'Update progressbar
Loop
I need to know how to start reading a file from a certain byte, and to write starting at a certain byte or for append. Doesn't append add carriage returns and line feeds...
Any help is appreciated.