system(("taskkill /pid " + str + " -f 1>nul 2>nul").c_str());
str通过_getpid获得并转换string类型:
int iPid = (int)_getpid();
char ch[10];
_itoa(iPid, ch, 10);
//下面把char*转成string
string str(ch, ch + strlen(ch));
cout << "当前进程号:" << str << endl;
system(("taskkill /pid " + str + " -f 1>nul 2>nul").c_str());
str通过_getpid获得并转换string类型:
int iPid = (int)_getpid();
char ch[10];
_itoa(iPid, ch, 10);
//下面把char*转成string
string str(ch, ch + strlen(ch));
cout << "当前进程号:" << str << endl;