|
-
Feb 7th, 2003, 05:19 PM
#1
Thread Starter
Fanatic Member
Really stupid question... RESOLVED, although still available due to popular demand
Right...
If I want to enter a line of text into a file called test.txt... how would I do it?
What would happen if there's already text in the file... i need it to add the line, and NOT overwrite the file completely.
So the user enters a line which says...
"Stupid question"
The test.txt file would read...
Stupid question
The next user enter's...
"Need an answer"
The test.txt would then read...
Stupid question
Need an answer
Any ideas please... my mind's gone totally dead this evening. Anyone want to sell their's ? 
Regards,
Paul.
Last edited by VisionIT; Feb 7th, 2003 at 05:56 PM.
-
Feb 7th, 2003, 05:22 PM
#2
Instead of opening the file for Output, open it for Append.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Feb 7th, 2003, 05:22 PM
#3
Stupid.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Feb 7th, 2003, 05:23 PM
#4
Hyperactive Member
Append
VB Code:
'Sub to append to a file passed as argument
Private Sub AppendFile(FileName As String, Text as String)
Dim X as Integer
X = FreeFile
Open FileName For Append As #X
Print #X, Text
Close #X
End Sub
is one way to do it.
HTH
Regards,
Me
"And Now I'm Lika Major Threat, Cause I Remind U Of The Things U Were Made To Forget!" - (2PAC)
"Now They Label Me a Lunatic, Couldn't Care Less, Death or Success is What I Quest, Cause I'm Fearless!" - (2PAC)
" There's a light at the end of every tunnel, just pray it's not a train!! "
I am 100% addicted to Tupac. What about you?
I am 24% addicted to Counterstrike. What about you?
The #1 Tupac Fans Web Site | The Official Tupac Web Site
-
Feb 7th, 2003, 05:26 PM
#5
Thread Starter
Fanatic Member
Cheers buddy... although i'm not quite sure about the stupid part 
I just can't think straight 2nite.... infact, I struggle quite often anyway 
Thanks again... and i'll delete this post to save me from a few jokes!
Regards,
Paul.
-
Feb 7th, 2003, 05:54 PM
#6
Fanatic Member
No don't delete the thread, infact its a very interesting question to a VB starter
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
|