Results 1 to 5 of 5

Thread: Strings

  1. #1

    Thread Starter
    Addicted Member Stephen Bazemore's Avatar
    Join Date
    Aug 2000
    Location
    North Carolina
    Posts
    158

    Strings

    What is the best way to take the contents of txt file and place it in a string?
    The way I'm trying to do it is not working.
    Code:
    On Error Resume Next
    Dim file As String
    Dim dirHolder As String
    file = App.Path & "\dir.rs"
    Open file For Input As #1
    Print #1, dirHolder
    Close #1
    I think the error is in using Print. I don't think that is the right command to use there. Please help.

    It is appreciated.
    Stephen Bazemore
    Email:[email protected]

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Print is for Output. Use Input for Input
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Addicted Member Stephen Bazemore's Avatar
    Join Date
    Aug 2000
    Location
    North Carolina
    Posts
    158
    Thanks m8!

    I'm such a n0ob.
    Stephen Bazemore
    Email:[email protected]

  4. #4
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    Reading them in a single operation is a good idea too. For small things it's not a big deal, but on larger files you could save time.
    VB Code:
    1. Dim strBuffer As String
    2. Open "yourfile.txt" For Binary As #1
    3. strBuffer = Space$(LOF(1))
    4. Get #1, 1, strBuffer
    5. Close #1
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  5. #5

    Thread Starter
    Addicted Member Stephen Bazemore's Avatar
    Join Date
    Aug 2000
    Location
    North Carolina
    Posts
    158
    Thanks Kaverin, I'll keep that in mind.
    Stephen Bazemore
    Email:[email protected]

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