|
-
Aug 13th, 2001, 08:24 PM
#1
Thread Starter
Addicted Member
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.
-
Aug 13th, 2001, 08:35 PM
#2
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
-
Aug 13th, 2001, 08:41 PM
#3
Thread Starter
Addicted Member
Thanks m8!
I'm such a n0ob.
-
Aug 13th, 2001, 09:09 PM
#4
Fanatic Member
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:
Dim strBuffer As String
Open "yourfile.txt" For Binary As #1
strBuffer = Space$(LOF(1))
Get #1, 1, strBuffer
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 
-
Aug 14th, 2001, 09:55 AM
#5
Thread Starter
Addicted Member
Thanks Kaverin, I'll keep that in mind.
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
|