• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to kill a process ???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: How to kill a process ???
      • From: Finlay Dobbie <email@hidden>
References: 
 >How to kill a process ??? (From: Thibaut Smets <email@hidden>)

  • Prev by Date: From NEXT, to Apple, to ... the world
  • Next by Date: Re: From NEXT, to Apple, to ... the world
  • Previous by thread: Re: How to kill a process ???
  • Next by thread: Re: How to kill a process ???
  • Index(es):
    • Date
    • Thread