Reads and displays bytes until end-of-file

image_pdfimage_print


   
 

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();
  }
}  
           
         
     


This entry was posted in File Stream. Bookmark the permalink.