|
-
Apr 12th, 2000, 04:17 AM
#1
Thread Starter
Junior Member
i'm creating a webserver... now i have to read the files in chunks, cause otherwise the program will read the whole file first and then send it...
i first had this code:
Public Function Read_File(filename)
Dim file
Dim textdata
On Error Resume Next
Dim i As Integer
i = 1
f = FreeFile
textda = ""
If FileExists(filename) Then
If Len(filename) Then
Open filename For Binary As #file
textdata = Input(LOF(file), #file)
DoEvents
Close #file
End If
text_read = textdata
Else
text_read = ""
End If
End Function
this is what i've come up with after a day programming but it also doesn't work:
Public Function Load_File(filename)
Const ChunkSize = 1024
Dim file
Dim textdata
On Error Resume Next
Dim i As Integer
i = 1
file = FreeFile
textda = ""
If FileExists(filename) Then
If Len(filename) Then
Open filename For Binary As #file
Do Until LOF(1) = Loc(1) Or EOF(1)
textdata = ""
If LOF(1) - Loc(1) < ChunkSize Then
textdata = String(LOF(1) - Loc(1), 0)
Else
textdata = String(ChunkSize, 0)
End If
Get #file, , textdata
text_read = textdata
Loop
'DoEvents
Close #file
End If
text_read = textdata
Else
text_read = ""
End If
End Function
but how can i use chunks? i just can't get it working correct ;(
thanks for your help
[Edited by D!SiLLUSiON on 04-12-2000 at 05:23 PM]
Life's hard, but the front of a train is harder 
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
|