BinaryReader、BinaryWriter 二进制文件Copy
//建立两个FileStream对象
FileStream fsOF = new FileStream(OriginFile,FileMode.Open,FileAccess.Read);
FileStream fsNF = new FileStream(NewFile,FileMode.Create,FileAccess.Write);
//建立分别建立一个读写类
BinaryReader br = new BinaryReader(fsOF);
BinaryWriter bw = new BinaryWriter(fsNF);
//将读取文件流指针指向流的头部
br.BaseStream.Seek(0,SeekOrigin.Begin);
//将写入文件流指针指向流的尾部
bw.BaseStream.Seek(0,SeekOrigin.End);
while(br.BaseStream.Position < br.BaseStream.Length)
{
//从br流中读取一个Byte并马上写入bw流
bw.Write(br.ReadByte());
}
br.Close();
bw.Close();