使用文件流拷贝一个较大的多媒体文件:
public static void CopyFile(string soucre, string target) { using (FileStream fsRead = new FileStream(soucre, FileMode.Open, FileAccess.Read)) { using (FileStream fsWrite = new FileStream(target, FileMode.OpenOrCreate, FileAccess.Write)) { byte[] buffer = new byte[1024*1024]; while (true) { int r = fsRead.Read(buffer, 0, buffer.Length); if (r == 0) { break; } fsWrite.Write(buffer, 0, r); } } } }
原文地址:http://blog.csdn.net/duoduoluojia/article/details/45422423