Read ASCII string from byte buffer : Text File Read Write : File Stream C# Source Code


Custom Search

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

 

Read ASCII string from byte buffer









    


using System;
using System.Globalization;
using System.Windows.Forms;
using System.Data;
using System.IO;

public class EntryPoint
{
    static void Main( string[] args ) {

        FileStream file = File.OpenRead("test.cs");
        byte[] buffer = new byte[1024];
        
        int c = file.Read(buffer, 0, buffer.Length);

        while (c > 0) 
        {
          Console.WriteLine(System.Text.ASCIIEncoding.ASCII.GetString(buffer));
          c = file.Read(buffer, 0, buffer.Length);
        }

        file.Close();
    }
}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo File Stream
» Text File Read Write