views:

102

answers:

3

Hi,

I would like to ask how can I stop a process programatically using C++?

Thanks.

+2  A: 

It's platform-dependent. On Unix you'd send the process a signal with the kill(2).

Nikolai N Fetissov
+2  A: 

This is a platform dependent question. Could you specify the platform you're worknig on?

For Windows you can use TerminateProcess

JaredPar
+2  A: 

Use exit function to terminate the calling process. If you want to terminate the process without executing destructors for objects of automatic or static storage duration you could use abort function.

Kirill V. Lyadvinsky
@Kyrill - I sure hope OP means a _different_ process, otherwise this must be a dup
Steve Townsend
@Steve, I'll delete my answer when OP will reveal this possible misunderstanding. It is not clear from the question.
Kirill V. Lyadvinsky