一、讀取文件,並轉換爲字節流
spa
FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read); byte[] infbytes = new byte[(int)fs.Length]; fs.Read(infbytes, 0, infbytes.Length); fs.Close(); return infbytes;
二、將字節流寫入文件
code
FileStream fs = new FileStream("D:\inf.dlv", FileMode.Create, FileAccess.Write); fs.Write(inf, 0, inf.Length); fs.Close();