Starting independent exes from inside a c program

This is a discussion on Starting independent exes from inside a c program within the C Programming forums, part of the General Programming Boards category; Hello, I'm not a very hard core programmer, and I don't really understand a lot of what goes on with ...

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    15

    Unhappy Starting independent exes from inside a c program

    Hello,

    I'm not a very hard core programmer, and I don't really understand a lot of what goes on with sub-processes etc.

    I need a simple c command to start off a completely seperate executable program from within my source code.
    I don't want the programs to be related in any way in particular. I want it to be as if i had typed the name of the executable into the command prompt, and that's it.

    I've looked at exec and its family, but I'm not sure what it meas about "overlaying" a process onto another, and how the first needs enough memory to accomodate the other etc. I am happy for the two programs to be oblivious to each other, except that one spawns the other.

    Hope that's clear, and I hope someone can help.

    Cheers,
    Phil Drew

  2. #2
    Registered User Cela's Avatar
    Join Date
    Jan 2003
    Posts
    362
    >>I want it to be as if i had typed the name of the executable into the command prompt, and that's it.
    Just put what you would type at the command prompt into a string and uss that as the argument to system(). For example, to get the current working directiory, say
    Code:
    system("dir");
    system() is in stdlib.h. :-)
    *Cela*

  3. #3
    Registered User
    Join Date
    Dec 2002
    Posts
    15
    Ooh, lovely - couldn't be simpler!
    I'll try it, thanks!

    Phil

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

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Originally posted by Hammer
    Did you read the FAQ ?
    Did you really need to ask?

    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    Registered User
    Join Date
    Jan 2003
    Posts
    99

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Starting a new program
    By histevenk in forum C++ Programming
    Replies: 28
    Last Post: 10-15-2007, 05:11 PM
  2. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 01:27 PM
  3. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 08:51 AM
  4. insufficient memory for tsr
    By manmohan in forum C Programming
    Replies: 8
    Last Post: 01-02-2004, 09:48 AM

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