Create StreamReader from File Stream : FileStream : File Stream C# Source Code


Custom Search

C# Source Code » File Stream » FileStream »

 

Create StreamReader from File Stream








    


using System;
using System.IO;

public class IOExample
{
  static void Main() {   
    FileStream fs;
    StreamReader srIn;

    try {
      fs = new FileStream("practice.txt", FileMode.Open );
      srIn = new StreamReader(fs);

      string line = srIn.ReadLine();

      Console.WriteLine("line = "+line);
      srIn.Close();
    } catch (IOException ioe) {
      Console.WriteLine("IOException occurred: "+ioe.Message);
    }
  }
}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo File Stream
» FileStream