Add text to .txt

Talk2Tom11

Well-known member
Joined
Feb 22, 2004
Messages
144
Location
Westchester, NY
hey, my problem is that I am not sure how to add text to a .txt file that already exists. What I want to do it just add the next text on the next line of the .txt file. If anyone knows the code to do this, that would great.
 
Forgive me all you c# users but I do know know how to do this with a filestream off the top of my head, so here it is using the dreaded VB libraries...

[VB]
Dim FileNumber As Integer = FreeFile()
FileOpen(FileNumber, ExistingFile, OpenMode.Append)
Print(FileNumber, AppendedText)
FileClose(FileNumber)
[/VB]

ExistingFile would be a string that contains the name of the file you want to append to. AppendedText is... you guessed it, the text to append.

Maybe someone more familiar with the FileStream class can show you a "better" way to do it. Ive been accessing files the VB way for years and some old habits die hard.
 
Back
Top