CopyFile

public void CopyFile(string sourcepath, string destpath)
{
    using (FileStream fs = new FileStream(sourcepath, FileMode.Open, FileAccess.Read))
    {
        using (FileStream fs2 = new FileStream(destpath, FileMode.Create, FileAccess.Write))
        {
            byte[] b = new byte[1024];
            int l = 0;
            while ((l = fs.Read(b, 0, b.Length)) > 0)
            {
                fs2.Write(b, 0, l);
            }
        }
    }
}

posted on 2009-08-13 13:08  Acor  阅读(170)  评论(0编辑  收藏  举报

导航