Popular Posts

There was an error in this gadget

Jun 13, 2012

Write in text file(C#)


 Create file at C:\Text\myText.txt

         try
            {
                string fileName = @"C:\Text\myText.txt";

                using (System.IO.StreamWriter writer = new System.IO.StreamWriter(fileName, true))
                {

                    writer.Write("Write some text here");

                }

            }

            catch (Exception exp)
            {

                Console.WriteLine(exp.Message);

            }

            Console.ReadKey();

No comments:

Post a Comment