Click to See Complete Forum and Search --> : FILE I/O


Jaleo
April 2nd, 2001, 11:47 AM
I get an "Out of string Space" error (errorcode 14) when I try to open an extremely large file.
I use "Open App.Path & "\bib.dat" For Input As #FileHandle ..." instruction.

Is there any restriction on the size of a file you open? I don't get the problem with a smaller version or
can it be matter of lack of enough RAM/diskspace?

Iouri
April 2nd, 2001, 12:21 PM
I believe that string length is limited. When you open a huge file ( which exceeds the max length of the string) you are getting this error.

Iouri Boutchkine
iouri@hotsheet.com

shree
April 2nd, 2001, 12:28 PM
I don't know, but you could use CreateFile() API

Iouri
April 2nd, 2001, 12:49 PM
try to use file system object

dim oFile as scripting.textstream
dim FSO as scripting.filesystemobject
dim str() as stringdim i as integer

set fso = new scripting.filesystemobject
set ofile = fso.opentextfile("Path to The File.txt", ForReading, false)
while not ofile.AtEndOfStream
str = split(ofile.readline, " ")
for i = lbound(str) to ubound(str)
msgbox str(i)
next i
wend
ofile.close
set ofile = nothing
set fso = nothing

don't forget to set referens to scripting objrct

Iouri Boutchkine
iouri@hotsheet.com

Spectre
April 2nd, 2001, 02:04 PM
A VB string or BSTR is a structure consisting of a 32 bit number (size of string) and the string data itself (remember it is a Unicode string so the characters are 16 bits not 8). Since the length of the string is expressed as a 32 bit number the max length of a VB string is 2,147,483,647 characters (a little over 2.1 GB).

Hope this helps.
Spectre

Jaleo
April 3rd, 2001, 09:32 AM
I resolved my problem with FSO - thanks for all the replies.