CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 1999
    Location
    CA
    Posts
    83

    Loading a text file into memory

    I was just wondering if I there was a way to load a file into memory where I could perform all file operations on it there and then save it back over the original file when I am ready. Is it possible to load a file to memory in VB and do something like this?
    Thanks


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Loading a text file into memory

    you could load the complete file contents into a string:

    Dim hfile as Integer
    hfile = FreeFile
    Dim strInput as string
    Dim lLen as Long
    Dim strfile as string
    strfile = "c:\test.htm"
    lLen = FileLen(strfile)
    strInput = string(lLen, " ")
    Open strfile for binary as #hfile len = lLen
    get #hfile, , strInput
    Close #hfile
    Debug.print strInput



    ...and manipulate the string contents afterwards


  3. #3
    Join Date
    Sep 1999
    Location
    CA
    Posts
    83

    Thanks, I'll try it...

    Thanks...


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