how to write a text file after the previous line in c#??
- by riad
Dear all,
My below code create a txt file and write something to that file.but i need to write new line after the previous lines when i run the script several times.
code:
string filePath = "D:\\DOT_NET\\C#\\abc.txt";
FileInfo t = new FileInfo(filePath);
StreamWriter Tex = t.CreateText();
Tex.WriteLine("Hi freinds");
Tex.WriteLine("csharpfriends is the new url for c-sharp");
Tex.Write(Tex.NewLine);
Tex.Close();
current output on the abc.txt file:
Hi friends
csharpfriends is the new url for c-sharp
but i need the output if i run the script several times.
Hi friends
csharpfriends is the new url for c-sharp
Hi friends
csharpfriends is the new url for c-sharp
Hi friends
csharpfriends is the new url for c-sharp
How can i do that?
Pls help
thanks
Riad