Tracking Multiple Processes in C Application

This is a discussion on Tracking Multiple Processes in C Application within the C Programming forums, part of the General Programming Boards category; Hello, I am running 4 parallel instances of my C application on a windows machine. I would be calling the ...

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    19

    Tracking Multiple Processes in C Application

    Hello,

    I am running 4 parallel instances of my C application on a windows machine. I would be calling the applications in my C code as below:

    Code:
    for (int I=0 ; I<4 ; I++)
    system("Start myCApplication.exe Parameter-I");
    Now, since 4 windows are running independently, I need to track them by fetching the Process ID of each and checking the count of the number of processes running. How can I fetch the number of processes running inside the C code?

    Thanks.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You need to use a system-call that gives you some sort of "handle" to the child-process. In Windows, you can use CreateProcess, in Linux you would probably use fork.

    Using system will not work unless you are doing a Rube Goldberg to use other system calls to dig out the process ID's of your child processes, and then checking up on those.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. why Multiple define error ...
    By nilathinesh in forum C Programming
    Replies: 2
    Last Post: 10-19-2006, 07:31 AM
  2. MULTIPLE C PROGRAMMER Opportunities
    By jdmuha in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 10-06-2006, 10:54 PM
  3. Windows form application and Windows application
    By |Wiz| in forum Windows Programming
    Replies: 5
    Last Post: 10-01-2005, 05:14 PM
  4. Replies: 1
    Last Post: 09-18-2005, 10:06 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 10:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21