|
How do you programatically open a file in c# to append?
I tried searching online for an example and so far I have not found anything.
There is System.IO.StreamWriter and there is System.IO.StreamReader but there is no StreamAppend. Is there some way to use StreamWriter without overwritting the content of the existing file? Is there some way to use System.IO.Stream with some sort of appending criteria?
|
|
|
|
|
You can use a FileStream with FileMode.Append
|
|
|
|
|
Xarzu wrote: How do you programatically open a file in c# to append?
As explained in the tutorials you can Google.
Xarzu wrote: I tried searching online for an example and so far I have not found anything.
"C# append text example". Nothing?
Xarzu wrote: System.IO.StreamWriter and there is System.IO.StreamReader
You don't need a stream; File.AppendAllText[^] does as requested. Usage is simple;
File.AppendAllText(@"C:\Temp\Test.txt", "Text to append");
|
|
|
|