Convert a File to Byte Arrary Function

1:44 AM
  public byte[] ReadByteArrayFromFile(string fileName)
       {
           byte[] buff = null;
           FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
           BinaryReader br = new BinaryReader(fs);
           long numBytes = new FileInfo(fileName).Length;
           buff = br.ReadBytes((int)numBytes);
           return buff;
       }

0 comments:

Post a Comment