错误代码998怎么解决
时间:2011-12-15
来源:互联网
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
cout<<"请输入您要监控的进程数:"<<endl;
int m;
cin>>m;
char** pp=new char*[m];//m represent first dimension
cout<<"请输入你要配置的进程路径:"<<endl;
int i;
for(i=0;i<m;++i)
{
pp[i]=new char[200];//n represent second dimension
cin.get();
cin.get(pp[i],200);
}
STARTUPINFO s[20];
PROCESS_INFORMATION p[20];
for(i=0;i<m;i++)
{
if(!CreateProcess(pp[i],NULL,NULL,NULL,FALSE,0,NULL,NULL,&s[i],&p[i]))
{
cout<<"创建进程"<<i+1<<"失败....."<<endl;
cout<<"错误代码:"<<GetLastError()<<endl;
}
cout<<"创建进程"<<i+1<<"成功,以下是进程信息:"<<endl;
cout<<"进程ID:"<<p[i].dwProcessId<<endl;
cout<<"线程Id:"<<p[i].dwThreadId<<endl;
}
aa: for(i=0;i<m;i++)
{
if(!WaitForSingleObject(p[i].hProcess,INFINITE))
{
CloseHandle(p[i].hProcess);
CloseHandle(p[i].hThread);
if(!CreateProcess( pp[i],NULL,NULL,NULL,FALSE,0,NULL,NULL,&s[i],&p[i]))
{
cout<<"创建进程"<<i+1<<"失败:....."<<endl;
cout<<"错误代码:"<<GetLastError()<<endl;
}
cout<<"创建进程"<<i+1<<"成功,以下是进程信息:"<<endl;
cout<<"进程ID:"<<p[i].dwProcessId<<endl;
cout<<"线程Id:"<<p[i].dwThreadId<<endl;
}
}
goto aa;
for(i=0;i<m;++i)//for delete
{
delete []pp[i];
}
delete []pp;
return 0;
}
显示998错误 查了下市内存分配访问无效 请教大神 怎么解决 谢谢
#include <windows.h>
using namespace std;
int main()
{
cout<<"请输入您要监控的进程数:"<<endl;
int m;
cin>>m;
char** pp=new char*[m];//m represent first dimension
cout<<"请输入你要配置的进程路径:"<<endl;
int i;
for(i=0;i<m;++i)
{
pp[i]=new char[200];//n represent second dimension
cin.get();
cin.get(pp[i],200);
}
STARTUPINFO s[20];
PROCESS_INFORMATION p[20];
for(i=0;i<m;i++)
{
if(!CreateProcess(pp[i],NULL,NULL,NULL,FALSE,0,NULL,NULL,&s[i],&p[i]))
{
cout<<"创建进程"<<i+1<<"失败....."<<endl;
cout<<"错误代码:"<<GetLastError()<<endl;
}
cout<<"创建进程"<<i+1<<"成功,以下是进程信息:"<<endl;
cout<<"进程ID:"<<p[i].dwProcessId<<endl;
cout<<"线程Id:"<<p[i].dwThreadId<<endl;
}
aa: for(i=0;i<m;i++)
{
if(!WaitForSingleObject(p[i].hProcess,INFINITE))
{
CloseHandle(p[i].hProcess);
CloseHandle(p[i].hThread);
if(!CreateProcess( pp[i],NULL,NULL,NULL,FALSE,0,NULL,NULL,&s[i],&p[i]))
{
cout<<"创建进程"<<i+1<<"失败:....."<<endl;
cout<<"错误代码:"<<GetLastError()<<endl;
}
cout<<"创建进程"<<i+1<<"成功,以下是进程信息:"<<endl;
cout<<"进程ID:"<<p[i].dwProcessId<<endl;
cout<<"线程Id:"<<p[i].dwThreadId<<endl;
}
}
goto aa;
for(i=0;i<m;++i)//for delete
{
delete []pp[i];
}
delete []pp;
return 0;
}
显示998错误 查了下市内存分配访问无效 请教大神 怎么解决 谢谢
作者: sqzhujianguo 发布时间: 2011-12-15
C/C++ code
for(i=0;i<m;i++) { s[i].cb = sizeof(STARTUPINFO); if(!CreateProcess(pp[i],NULL,NULL,NULL,FALSE,0,NULL,NULL,&s[i],&p[i]))
作者: bEst_02 发布时间: 2011-12-15
引用 1 楼 best_02 的回复:
C/C++ code
for(i=0;i<m;i++)
{
s[i].cb = sizeof(STARTUPINFO);
if(!CreateProcess(pp[i],NULL,NULL,NULL,FALSE,0,NULL,NULL,&s[i],&p[i]))
C/C++ code
for(i=0;i<m;i++)
{
s[i].cb = sizeof(STARTUPINFO);
if(!CreateProcess(pp[i],NULL,NULL,NULL,FALSE,0,NULL,NULL,&s[i],&p[i]))
依然998啊
作者: sqzhujianguo 发布时间: 2011-12-15
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28