StreamWriter.Flush : StreamWriter « System.IO « C# / C Sharp by API






StreamWriter.Flush

  
using System;
using System.IO;

public class MainClass
{
  public static void Main() 
  {
    FileStream outStream = File.Create("c:\\TextTest.txt");
    StreamWriter sw = new StreamWriter(outStream);
    sw.WriteLine("This is a test of the StreamWriter class");
    sw.Flush();
    sw.Close();
    StreamReader sr = new StreamReader("c:\\TextTest.txt");
    string FirstLine;
    FirstLine = sr.ReadLine();
    Console.WriteLine(FirstLine);
    sr.Close();
  }
}

   
    
  








Related examples in the same category

1.new StreamWriter
2.StreamWriter.Write
3.StreamWriter.WriteLine