X
xxxyyyuuu
Unregistered / Unconfirmed
GUEST, unregistred user!
这是我想拷贝一个文件是写的,但不知为什么有时可以有时不可以?不行的时候提示:无法读取源文件或磁盘<br>TSaveDialog *savedlg=new TSaveDialog(this);<br> savedlg->Filter = "数据文件(*.mdb)|*.mdb";<br> savedlg->DefaultExt="mdb";<br> savedlg->FilterIndex = 0;<br> savedlg->Title="备份文件到";<br><br> TSHFileOpStruct fos;<br> char *buf1=new char[256];<br> char *buf2=new char[256];<br> AnsiString Str1,Str2;<br> Str1= edit_db_target->Text;<br> if (savedlg->Execute())<br> if (savedlg->FileName!="")<br> {<br> Str2=savedlg->FileName;<br> StrPCopy(buf1,Str1);<br> StrPCopy(buf2,Str2);<br> fos.hwnd=Application->MainForm->Handle;<br> fos.wFunc=FO_COPY;<br> fos.pFrom=buf1;<br> fos.pTo=buf2;<br> fos.fFlags= FOF_SIMPLEPROGRESS;<br> fos.fAnyOperationsAborted=false;<br> fos.hNameMappings=NULL;<br> fos.lpszProgressTitle="正在备份文件...";<br> SHFileOperation(&fos);<br> }<br> delete savedlg;<br> delete []buf1;<br> delete []buf2;