Fork me on GitHub
.net1.1 Read Byte Array From File
/// <summary>
		/// Reads the byte array from file.
		/// </summary>
		/// <param name="fileName">Name of the file.</param>
		/// <returns></returns>
		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 on 2010-04-30 16:41  HackerVirus  阅读(232)  评论(0编辑  收藏  举报