How to append data to a file in C#

1 Answer

0 votes
using System;
using System.IO;

namespace Append_Data_To_TextFile
{
    class Program
    {
        static void Main(string[] args)
        {
            FileStream fs = new FileStream("d:\\test.txt", FileMode.Append, FileAccess.Write);

            StreamWriter sw = new StreamWriter(fs);

            sw.WriteLine("The append line");
            sw.Close();
            fs.Close();
        }
    }
}



answered Sep 3, 2014 by avibootz

Related questions

1 answer 318 views
318 views asked Aug 15, 2014 by avibootz
1 answer 296 views
296 views asked Apr 26, 2017 by avibootz
1 answer 304 views
1 answer 265 views
1 answer 333 views
4 answers 396 views
396 views asked Oct 18, 2023 by avibootz
1 answer 230 views
...