using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
string oldF = @"C:\Users\Administrator\Desktop\duotai.avi";
string newF = @"C:\Users\Administrator\Desktop\duotai-copy.avi";
copyFile(oldF, newF);
Console.WriteLine("拷贝成功。");
Console.ReadKey();
}
public static void copyFile(string oldFile, string newFile)
{
using (FileStream fileRead = new FileStream(oldFile, FileMode.OpenOrCreate, FileAccess.Read))
{
using (FileStream fileWrite = new FileStream(newFile, FileMode.Create, FileAccess.Write))
{
byte[] b = new byte[1024 * 1024 * 10];
while (true)
{
int r = fileRead.Read(b, 0, b.Length);
if (r == 0)
{
break;
}
fileWrite.Write(b, 0, r);
}
}
}
}
}
}
FileStream流
最新推荐文章于 2021-07-22 18:49:19 发布