作者pthuang (◢晓筱◤)
站内Programming
标题Re: [问题] 如何copy .exe档用c++
时间Wed Apr 9 02:57:15 2008
: > 请问要如何用c++ copy 执行档 .exe到某个目录
: > 我用过copyfile(xx,xx,b)和fstream的方法
: > copyfile没用,而fstream则拷贝完後不能存取
: > 请问有何解
: 直接呼叫API就可以....
: #include <windows.h>
: #include <stdio.h>
: int main(int argc, LPTSTR argv[])
: {
: if(argc!=3)
: {
: printf("Usage: cp file1 file2\n");
: return 1;
: }
: if(!CopyFile(argv[1],argv[2],FALSE))
: {
: printf("CopyFile Error:%x\n",GetLastError);
: return 2;
: }
: system("PAUSE");
: return 0;
: }
用到 API 的话
那根本就可以直接用 Windows 下的 xcopy 了吧...
配上 system(); 应该不是什麽难事 0.0
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 118.169.99.23
1F:嘘 easterday:system这种指令应该能不用就不用... 59.116.141.208 04/10 12:58
2F:→ pthuang:我知道 但这麽说起来 API 的东西是否也118.169.106.107 04/10 13:39
3F:→ pthuang:该能不用就不用呢?118.169.106.107 04/10 13:40
4F:→ pthuang:而且比起 API 那指令也只是去 Call Syst-118.169.106.107 04/10 13:42
5F:→ pthuang:em Shell 而已呀...118.169.106.107 04/10 13:42