Read text file line by line : Text File Read Write : File Stream C# Source Code


Custom Search

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

 

Read text file line by line








    
 
using System;
using System.IO;

public class ReadWriteApp
{
    public static void Main(string[] args)
    {
        FileStream s = new FileStream("Bar.txt", FileMode.Create);
        StreamWriter w = new StreamWriter(s);
        w.Write("Hello World");
        w.Close();
   
        s = new FileStream("Bar.txt", FileMode.Open);
        StreamReader r = new StreamReader(s);
        string t;
        while ((t = r.ReadLine()) != null)
        {
            Console.WriteLine(t);
        }
        w.Close();
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo File Stream
» Text File Read Write