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 243 views
243 views asked Aug 15, 2014 by avibootz
1 answer 200 views
200 views asked Apr 26, 2017 by avibootz
1 answer 198 views
1 answer 168 views
1 answer 232 views
4 answers 192 views
192 views asked Oct 18, 2023 by avibootz
1 answer 134 views
...