赞
踩
private static void BigFileCopy(string source, string target) { using (FileStream fsRead = File.OpenRead(source)) { using (FileStream fsWrite = File.OpenWrite(target)) { byte[] bytes = new byte[5 * 1024 * 1024];//定义5M空间 int count = 0; while ((count = fsRead.Read(bytes, 0, bytes.Length)) > 0) { fsWrite.Write(bytes, 0, count); //fsRead.Position 表示已经读取的字节个数 double per = (fsRead.Position / (double)fsRead.Length) * 100; Console.WriteLine($"{per:0.00}%"); } } } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。