Reading Binary Information from a File - CSharp File IO

CSharp examples for File IO:Binary File

Description

Reading Binary Information from a File

Demo Code

using System;/* w w  w.  ja  v a 2s.  com*/
using System.IO;
class BinReader
{
   public static void Main(String[] args)
   {
         FileStream myFile = new FileStream("main.cs", FileMode.Open);
         BinaryReader brFile = new BinaryReader(myFile);
         while( brFile.PeekChar() != -1 )
         {
            Console.Write("<{0}> ", brFile.ReadInt32());
         }
         brFile.Close();
         myFile.Close();
   }
}

Result


Related Tutorials