HOW TO OPEN FILE IN APPEND MODE IN C#

Anupam Mishra

Total Post:135

Points:949
Posted by  Anupam Mishra
C#  .NET 
C#
 656  View(s)
Ratings:
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.
  1. Anupam Mishra

    Post:135

    Points:949
    Re: How to open file in append mode in c#

    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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!