Create FileStream from FileInfo : File Info : File Stream C# Source Code


Custom Search

C# Source Code » File Stream » File Info »

 

Create FileStream from FileInfo








    

using System;
using System.IO;

class FileFileInfoApp
{
    static void Main(string[] args)
    {
        FileInfo f = new FileInfo("Bar.txt");
        FileStream fs = f.Create();
   
        StreamWriter w = new StreamWriter(fs);
        w.Write("Hello World");
        w.Close();
   
        fs = f.Open(FileMode.Open, FileAccess.Read, FileShare.None);
        StreamReader r = new StreamReader(fs);
        string t;
        while ((t = r.ReadLine()) != null){
            Console.WriteLine(t);
        }
        w.Close();
        fs.Close();
        f.Delete();
    }
}
           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo File Stream
» File Info