Home > DeveloperSection > Forums > How to open file in append mode in c#
Anupam Mishra

Total Post:135

Points:949
Posted on    January-22-2016 4:29 AM

 C# C#  .NET 
Ratings:


 1 Reply(s)
 345  View(s)
Rate this:
Hi Everyone,
I want to create a file "Test.txt" and it will open in append mode.I am trying  many times but it is overwrite the previous data .So, please give me a solution. 
thank you.


Anupam Mishra

Total Post:135

Points:949
Posted on    January-22-2016 4:45 AM

For create a file in append mode ,we need to use this constructor.

StreamWriter file = new  StreamWriter(".../Text.txt", bool append);

file.WriteLine("your text");

if file are exist in specified path otherwise it will created a new one as well as it will start  write in append mode(if bool append is true otherwise file will be override ).


 

Modified On Jan-22-2016 04:46:35 AM

Don't want to miss updates? Please click the below button!

Follow MindStick