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();
}
}
Related examples in the same category