Steve

Steve

  • NA
  • 10
  • 0

BinaryReader Object issues

Jan 29 2008 11:57 PM
Hi all!  I'm having issues with a basic C# program, on my first attempt.  I'm getting a null object not instantiated error when I attempt to ReadByte in the second procedure:

public void Main(string FileName)
        {
            System.IO.FileStream FS = new System.IO.FileStream(FileName, System.IO.FileMode.Open);
            System.IO.BinaryReader BR = new System.IO.BinaryReader(FS);

            ReadHeader(ref BR);


            BR.Close();
            FS.Close();
        }

        private void ReadHeader(ref System.IO.BinaryReader BR)
        {
            for (int ii = 0; ii < 32; ii++)
            {
                MarkerInfo.Header.bB1_32[ii] = BR.ReadByte();
            }
       }

Any help, much appreciated!

Answers (5)