In pseudocode…
processHandle = _spawnl(_P_NOWAIT, "foo.exe", ...);
/* time passes... */
WossnameKillFunction(processHandle);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no terminate counterpart to the VC++ function
_spawnl(), but it does return a Win32HANDLEthat you can use:Note it only returns a
HANDLEif you call it with one of theNOWAITargs. If not, it will return the process’s exit code.Of course, it’s far better if you can somehow communicate to the process that it should exit gracefully.
TerminateProcesswill prevent any cleanup code from being called.(And as a small side note: despite what MSDN says about
spawnl()being a deprecated POSIX function, it’s actually never been in any POSIX standard! As far as I know it originates from QNX.)