StreamReader.ReadLine : Stream Read Write : File Stream C# Source Code


Custom Search

C# Source Code » File Stream » Stream Read Write »

 

StreamReader.ReadLine








    
 
using System;
using System.IO;
public class MainClass {
    public static void Main() {

        FileStream fs2 = File.Create("Bar.txt");

        StreamWriter w2 = new StreamWriter(fs2);
        w2.Write("Goodbye Mars");
        w2.Close();

        fs2 = File.Open("Bar.txt", FileMode.Open, FileAccess.Read, FileShare.None);
        StreamReader r2 = new StreamReader(fs2);
        String t;
        while ((t = r2.ReadLine()) != null) {
            Console.WriteLine(t);
        }
        w2.Close();
        fs2.Close();

    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo File Stream
» Stream Read Write