Thread: Interacting with other programs

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    4

    Interacting with other programs

    Hello everyone!

    I am fairly new to C++ programming, and would appreciate help. I would like to know some functions for altering other programs, mostly commands to stop a program from running and commands to start running a program. Thank you!

  2. #2
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    Hi,

    for starting use http://en.wikipedia.org/wiki/System_...ard_Library%29

    for stopping: do we speak of stopping programs you wrote, or stopping other programs generally?
    in the first case you want to communicate to the other program somehow, through filesystem or network connection for example. the other program listen to that and ends itself.
    in the second case you have to use os-dependent things. on linux you can send signals to every process (term or kill for example) . I guess on win32 does exist a similar mechanism.
    Last edited by pheres; 08-06-2007 at 12:51 AM.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    In windows you can use "TerminateProcess" - but you either need to administrator rights or the same user that started the process.

    Note that I don't think this is the same as what you are asking for - a method to stop a program from running is usually a "Security setting" for the user (e.g. a user with administrator rights/root privilege can run application A, but regular user's cant. Application B can be run by anyone who belongs to a certain group - there are more complicated variations as well)- and that is also OS-dependant (that is, it works differently in Linux than it does in Windows), and I don't know much about how you access any of that functioanality in C/C++.

    This of course has no relation to C or C++ - the functionality is part of the OS, and unrelated to the language being used.

    --
    Mats

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Recommend upgrade path for C programs
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-22-2007, 07:32 AM
  2. interacting between programs
    By voodoomagic in forum C Programming
    Replies: 1
    Last Post: 11-19-2004, 07:59 PM
  3. Interacting with other programs with readline
    By Provost in forum C Programming
    Replies: 1
    Last Post: 08-13-2004, 06:24 AM
  4. POSIX/DOS programs?
    By nickname_changed in forum C++ Programming
    Replies: 1
    Last Post: 02-28-2003, 05:42 AM
  5. executing c++ programs on the web
    By gulti01 in forum C++ Programming
    Replies: 4
    Last Post: 08-12-2002, 03:12 AM