频道栏目
首页 > 资讯 > 其他 > 正文

获取子进程的退出码“编程开发”

17-12-20        来源:[db:作者]  
收藏   我要投稿

获取子进程的退出码“编程开发”

#include "stdafx.h"
#include "windows.h"
#include "iostream"
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	LPCTSTR lpName(_T("zzc"));  
	LPCTSTR lpValue(_T("88888"));  

	//设置环境变量的值
	::SetEnvironmentVariable(lpName,lpValue);  

	STARTUPINFO si;  
	PROCESS_INFORMATION pi;  

	ZeroMemory(&si, sizeof(si));  
	ZeroMemory(&pi, sizeof(pi));

	if( !CreateProcess( _T("D:\\绘图编程\\父子进程通信-环境变量\\Child\\Debug\\Child.exe"),  
		NULL,  
		NULL,   
		NULL, 
		TRUE,
		CREATE_NEW_CONSOLE/*DETACHED_PROCESS*/,//新进程使用自己的可控制台窗口  
		NULL,  
		NULL,   
		&si,  
		&pi) )  
	{  
		cout <<"shibai" <

 

 

 

#include "stdafx.h"
#include "windows.h"
#include "iostream"
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	LPCTSTR lpName(_T("zzc"));   
	int nlength = ::GetEnvironmentVariable(lpName,NULL,0);  
	LPTSTR lpValue = new TCHAR[nlength+1];  
	memset(lpValue,'\0',nlength+1);  
	::GetEnvironmentVariable(lpName,lpValue,nlength+1);

	setlocale(LC_ALL, "chs");
	_tprintf(lpValue);

	cout <<>

 

 

相关TAG标签
上一篇:Three.js拉伸几何体THREE.TubeGeometry代码详解
下一篇:php pdo占位符的使用(代码实例讲解)
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站