按字节地复制文件

FileStream srcfile = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
FileStream desfile = new FileStream(path2, FileMode.Create, FileAccess.Write, FileShare.Write);

int Length = (int) srcfile.Length;
byte[] arrBytes = new byte [Length];
srcfile.Read(arrBytes, 0 , Length);
desfile.Write(arrBytes, 0 , Length);

你可能感兴趣的:(文件)