-
September 11th, 2012, 01:14 PM
#1
Out of Memory - Reading a 80MB file into memory in VB6
I'm getting a VB6 "Out of Memory" error when reading contents from a large file (80MB) into memory to be streamed to a web service using the Microsoft INet Control. The web service only accepts a single "POST" call from the VB6 application to process the entire contents of the file. Below is the code snippet that I am using. The line in red is where I get the "Out of Memory" error. It is happening with "TSO.Read(FileName.Size - 1)". Can anyone help me resolve this issue?
Thanks
-------------------------------------------
Dim FSO As FileSystemObject
Dim TSO As TextStream
Dim FileName As File
Dim strImportFile As String
strImportFile = GetImportFileName() ' gets the import filename
HttpRequestHeader = GetRequestHeader() ' gets the http request header (25 character string)
If Trim(strImportFile) <> vbNullString Then
Set FSO = New FileSystemObject
Set FileName = FSO.GetFile(strImportFile)
Set TSO = FileName.OpenAsTextStream(ForReading, TristateFalse)
'stream the data from the file to a webservice using Microsoft INet Control
m_Inet.Execute , "POST", TSO.Read(FileName.Size - 1), HttpRequestHeader
TSO.Skip FileName.Size
TSO.Close
End If
Set TSO = Nothing
Set FSO = Nothing
-------------------------------------------
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
|