start another program

This is a discussion on start another program within the C Programming forums, part of the General Programming Boards category; I want to write a program and under some condition to start another program. How I can start another program ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    5

    Smile start another program

    I want to write a program and under some condition to start another program. How I can start another program that is not in the same folder ??

    I use system function, but it work for only in the same folder. Is there any other function which I can start another program not in the same folder ?

    Thanks

    lshome@yahoo.com

  2. #2
    Registered User
    Join Date
    Jun 2002
    Posts
    14
    You can use the system() function, here's an example:
    Code:
    #include <stdlib.h>
    
    int main(void)
    {
       system("c:\\prog.exe");
       return 0;
    }

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    39
    You can also use exec().

    You would need to decide whether you want to replace the currently running process or launch a new process.

    Hope this helps.
    <Signature
    name="Ruchikar"
    quote="discussions are forgotten, only code remains"/>

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Try the FAQ
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to start program from subfolder
    By trancedeejay in forum C Programming
    Replies: 2
    Last Post: 04-01-2006, 02:39 PM
  2. Start program before login with WinXP
    By Icewind2003 in forum Tech Board
    Replies: 3
    Last Post: 02-12-2003, 03:50 PM
  3. Start up program
    By Breetai in forum Windows Programming
    Replies: 2
    Last Post: 01-11-2003, 12:12 PM
  4. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM
  5. Start a program
    By FunkeeMunkee in forum C++ Programming
    Replies: 1
    Last Post: 08-26-2001, 07:18 PM

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