Skip to main content
GameDev.net gamedev.net
🔒 Locked

Call a program from a program in C

Started by fiffig Jan 9, 2007 at 12:00 PM 4 replies 800+ views
Original Post
fiffig
fiffig
Hi, I was wondering how one might go about opening a program, (console program for simplicity) and say there is a menu with different programs you could run, and when a user hits one of those choices, the current program will close or cease running, and the new program will start to run. Im sure this is a fairly simple problem. Any ideas? Im working with the C language. - Thanks.
rip-off
rip-off
Operating system?

With linux/unix you can exec*().

With windows there are functions like CreateProcess() I think.
wasd
wasd
It depends on what O/S you're targetting. If it's windows, you could try looking at the _spawn function.
Ra
Ra
Quote:
Original post by Anonymous Poster
or just simply: "system("dir");"


Just a note: system() is blocking and doesn't allow your app to continue until after the program that was executed quits. The return value is the exit code of the program.
Ra
fiffig
fiffig
yes it is windows, i will try and mess around with what has been replied. Thank you.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.