改完如下:
#include
#include
#include
#include
#include
#include
using namespace std;
int main()
{
string str;
cout << "Please Enter Object Path To Installer:" ;
cin >> str ;
char buffer[1024]={0}; // char* 改成char
sprintf(buffer,"copy -y fri.exe ",str);
system(buffer);
sprintf(buffer,"copy -y friny.exe ",str);
system(buffer);
sprintf(buffer,"copy -y help.exe ",str);
system(buffer);
sprintf(buffer,"copy -y simple.fri ",str);
system(buffer);
return 0;
}
1 char* buffer[1024]={0};
改成 char buffer[1024]={0};
2 没一句sprintf都没有将路径复制进去,例如
sprintf(buffer,"copy -y fri.exe ",str);
改成
sprintf(buffer,"copy -y fri.exe %s",str);
调用CopyFile函数不行么?
就不乱跳窗口了。
同意cqwingbbs。