windows - run the same exe with different argument simultaneous in c++ -
does have idea open same exe file different arguments @ same time in c++.
in past, open multiple commend line in windows run exe simultaneously,
however, seems not best way solve it. hence try implement in c++ automatically run multiple processing @ same time.
have tried this, still can not work....
problem:
e.g. run
1. a.exe -dir d: -num 1000
2. a.exe -dir d: -num 1500
3. a.exe -dir d: -num 2500
@ same time in c++.
(answered op in edits. see question no answers, issue solved in comments (or extended in chat) )
the ops solution is:
sol:
std::ostringstream trainsamplescmd[2]; trainsamplescmd[0] << "a.exe -data cascade/1 -vec vec/test.vec -bg neg.txt -numpos 1000 -numneg 1000 -w 30 -h 14"; trainsamplescmd[1] << "a.exe -data cascade/2 -vec vec/test.vec -bg neg.txt -numpos 1500 -numneg 1000 -w 30 -h 14"; for(int = 0; < 2; i++) { startupinfo si; process_information pi; zeromemory( &si, sizeof(si) ); si.cb = sizeof(si); zeromemory( &pi, sizeof(pi) ); if( !createprocess( null, // no module name (use command line) const_cast<char *>(trainsamplescmd[i].str().c_str()), // command line null, // process handle not inheritable null, // thread handle not inheritable false, // set handle inheritance false 0, // no creation flags null, // use parent's environment block null, // use parent's starting directory &si, // pointer startupinfo structure &pi ) // pointer process_information structure ) { printf( "createprocess failed (%d).\n", getlasterror() ); system("pause"); return 0; } }
Comments
Post a Comment