Re: How to kill a process ???
Re: How to kill a process ???
- Subject: Re: How to kill a process ???
- From: Graham Wihlidal <email@hidden>
- Date: Fri, 31 Aug 2001 14:50:07 -0600
>
I would like to kill a process inside my cocoa application. I know that
>
there is no Cocoa API to do it , it seems that the only way to achieve
>
it is to use some UNIX API .
>
Could someone guide me please because I dont have any experience with
>
UNIX programming ?? Does it mean that I have to call a script which
>
executes the command line ps ??
Why don't you just use the system() function?
For example, say your executable (which is running) is called MyProgram and
you want to kill everyone running occurence of it, you use:
system("killall MyProgram");
or a nicer, yet more difficult way (you must know the process id) is to do
the following:
system("kill ###"); where ### is the process id
you can get the process id's with ps
Hope that helps somewhat,
Graham Wihlidal