Text file Write with format and write boolean value to a text file

image_pdfimage_print
   
 
using System;
using System.IO;

class Class1{
      static void Main(string[] args){
         try
         {
            FileStream aFile = new FileStream("practice.txt",FileMode.OpenOrCreate);
            StreamWriter sw = new StreamWriter(aFile);
            
            bool truth = true;
            sw.WriteLine("A");
            sw.WriteLine("{0}",System.DateTime.Now.ToShortDateString());
            sw.Write("A");
            sw.Write("www.kutayzorlu.com/java2s/com",truth);

            sw.Close();
         }
         catch(IOException e)
         {
            Console.WriteLine("An IO exception has been thrown!");
            Console.WriteLine(e.ToString());
            Console.ReadLine();
            return;
         }
         return;
      }
}


           
         
     


This entry was posted in File Stream. Bookmark the permalink.