使用ACE创建进程

http://blog.csdn.net/maxcode/archive/2009/02/14/3891070.aspx

  1. #include "stdafx.h"
  2. #include "ace/Log_Msg.h"
  3. #include "ace/OS_NS_unistd.h"
  4. #include "ace/Process_Manager.h"
  5. #define NUM_PROCESSES 4
  6. int ACE_TMAIN(int argc, ACE_TCHAR* argv[])  
  7. {  
  8. //获得进程管理器
  9.     ACE_Process_Manager* pm = ACE_Process_Manager::instance();  
  10. //创建一个option,通option设置进程的一些属性
  11.     ACE_Process_Options options;  
  12.     options.command_line(ACE_TEXT("notepad.exe 1.txt"));  
  13.     pid_t pids[NUM_PROCESSES];  
  14. for (int i = 0; i < NUM_PROCESSES;i++)  
  15.     {  
  16. //设置命令行参数,启动记事本程序
  17.         options.command_line(ACE_TEXT("notepad.exe %d.txt"),i);  
  18. //生成一个进程
  19.         pids[i] = pm->spawn(options);  
  20.     }  
  21. //等待所有的进行执行完毕后才退出父进程。
  22.     pm->wait();  
  23. return 0;  
原文地址:https://www.cnblogs.com/xianqingzh/p/1898088.html