5
Answers

BinaryReader Object issues

Steve

Steve

16y
2.6k
1
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)