[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: LINUX and C programming



> 
> 	Can you tell me if it's possible to execute linux shell commands
> from **inside** a c program?
> 

Try using the 'system' function. It is however not advised and is unsafe.
A good alternative is to fork and let the parent wait and let the child
exec the shell command after properly 'dup'ing the file
descriptors(0,1,2).Check out Kernighan and Pike (The UNIX programming
environment) for a function that does this. It's basically the same as
'system' but you'll have more control

LiNaC

____________________________________________________________________________
You will always find something in the last place you look.