Linux.com

Author Message
Joined: Jun 30, 2008
Posts: 148
Other Topics
Posted Dec 09, 2008 at 3:30:32 AM
Subject: C: Launching a program from a program
I know some C and some Ncurses, and I wanted to learn how to make a little menu program which displays the names of three or four external programs, and then executes the program selected by the user. When the selected program terminates, the user is returned to the menu program. (Similiar to those old DOS menus which some people used before Windows came along.) Could anyone start me off in the right direction? Specifically, I was wondering about how I should approach calling the external program that the user requests. I found a few pages online about executing programs from inside C, but they tended to be somewhat complex with lots of discussion about inter-process communication and piping and such. Is there a C library for that makes this fairly simple? (Even if it is a *nix only library...) It might also be helpful if someone could point me to a program that does something similar to what I described.

PerlCoder (http://indicium.us)

Back to top Profile Email Website
tophandcwby
Joined Apr 10, 2008
Posts: 81

Other Topics
Posted: Dec 09, 2008 2:52:48 PM
Subject: C: Launching a program from a program
http://www.gnu.org/software/libc/manual/html_node/Processes.html#Processes That should help a little anyhow.
Back to top Profile Email Website
proopnarine

Joined Apr 03, 2008
Posts: 590
Location:San Francisco

Other Topics
Posted: Dec 10, 2008 4:55:10 AM
Subject: C: Launching a program from a program
Hey PerlCoder, I'm not an Ncurses user, though I'd love to learn more about it for exactly the reasons you outline. But in the past, for issuing commands or calling programs from within C++ programs, I've used the "popen" function.

Take the red pill

Climate Change Blog

Food Weblog

Back to top Profile Email Website
PerlCoder
Joined Jun 30, 2008
Posts: 148

Other Topics
Posted: Dec 10, 2008 7:32:19 PM
Subject: C: Launching a program from a program
Thanks guys! This is just what I was looking for.

PerlCoder (http://indicium.us)

Back to top Profile Email Website
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya