日期:2014-05-18 浏览次数:21033 次
while (true)
{
i = sr.Read(bytes, 0, 256);
sw.Write(bytes, 0, i);
if (i < 256)
{
break;
}
}
------解决方案--------------------
直接调用方法。如果真自己写,实际是重新建立文件,读取写入,好好看下代码。
------解决方案--------------------
private void Copy()
{
FileStream fsOpen = new FileStream(txtOpen.Text, FileMode.Open);
FileStream fsSave = new FileStream(txtSave.Text, FileMode.Create);
byte[] bytes=new byte[fsOpen.Length];
fsOpen.Read(bytes, 0, bytes.Length);
fsSave.Write(bytes, 0, bytes.Length);
fsSave.Close();
fsOpen.Close();
}
------解决方案--------------------
char[] bytes = new char[256]; 改成byte[] bytes = new byte[256]; 试试