Write To Text File Using Streamwriter C
I'd like to add new line with text to my date.txt file, but instead of adding it into existing date.txt, app is creating new date.txt file.
Nov 09, 2010 Im trying to create simple program with C-sharp using visual studio 2010 that reads text from text file,prints that to box, this part i done, and after that can pick line and add to that line new text, example: First line Second line.
I'd like to open txt file, add some text, close it, and later after clicking something: open date.txt, add text, and close it again.
So i can get:
Button pressed: txt opened -> added current time, then close it. Another button pressed, txt opened -> added text 'OK', or 'NOT OK' in the same line, then close it again.
So my txt file will look like that:
How can i do this? Thanks!
4 Answers
Python Write To Text File
You could do it easily using
Managing successful projects with prince 2. If you need newline
Anyway if you need your code do this:
with second parameter telling to append to file.
Check here StreamWriter syntax.
Vba Write To Text File
Why not do it with one method call:
which will do the newline for you, and allow you to insert multiple lines at once if you want.
