日期:2014-05-18 浏览次数:21129 次
class Program { static void Main(string[] args) { test1(); Console.ReadKey(); } static void test1() { //把文件转换成二进制流 byte[] byteData = new byte[100]; FileStream fs = new FileStream(@"c:\1.txt", FileMode.Open, FileAccess.Read); BinaryReader read = new BinaryReader(fs); read.Read(byteData, 0, byteData.Length); foreach (byte b in byteData) { Console.Write(" {0} ", b); } } static void test2() { //把文件转换成二进制流 byte[] byteData = new byte[100]; FileStream fs = new FileStream(@"c:\1.txt", FileMode.Open, FileAccess.Read); fs.Read(byteData, 0, byteData.Length); foreach (byte b in byteData) { Console.Write(" {0} ", b); } } }