CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: FILE I/O

  1. #1
    Join Date
    Aug 2000
    Location
    SA
    Posts
    11

    FILE I/O

    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?




  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: FILE I/O

    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
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: FILE I/O

    I don't know, but you could use CreateFile() API


  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: FILE I/O

    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
    [email protected]
    Iouri Boutchkine
    [email protected]

  5. #5
    Join Date
    Feb 2000
    Posts
    137

    Re: FILE I/O

    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



  6. #6
    Join Date
    Aug 2000
    Location
    SA
    Posts
    11

    Re: FILE I/O

    I resolved my problem with FSO - thanks for all the replies.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured