Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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.
  • Leaders
Posted

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...

 

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

 

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. I've been accessing files the VB way for years and some old habits die hard.

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...