Reads and displays bytes until end-of-file
using System; using System.IO; public class ReadBytes { public static void Main(string[] args) { Stream input = new FileStream("test.cs", FileMode.Open); int i; while((i = input.ReadByte()) != -1) Console.Write(i + " "); input.Close(); } }