Convert A File To Byte Arrary Function

  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;
       }
posted @ 2012-04-01 14:49  sandeepparekh9  阅读(147)  评论(0编辑  收藏  举报