how to write a text file after the previous line in c#??
Posted
by riad
on Stack Overflow
See other posts from Stack Overflow
or by riad
Published on 2010-05-25T12:37:25Z
Indexed on
2010/05/25
12:41 UTC
Read the original article
Hit count: 197
c#
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
© Stack Overflow or respective owner