文件读写
using(FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read)) { byte[] buffer=new byte[1024*100]; //FileMode.Append 如果文件已存在将在结尾处添加 如果不存在将创建 //using (FileStream fsWrite = new FileStream(paths, FileMode.Append, FileAccess.Write)) //FileMode.Append 如果文件重名则覆盖 using (FileStream fsWrite = new FileStream(paths, FileMode.OpenOrCreate, FileAccess.Write)) { while (true) { int r = file.Read(buffer, 0, buffer.Length); if (r == 0) { break; } fsWrite.Write(buffer, 0, r ); } } }