tags:

views:

56

answers:

1

which function do i use to give such linux terminal calls in my c program?

+8  A: 

system would be the correct posix call. It takes a pointer to char as the command to be executed. See man 3 system. However system can be completely corrupted by environment variables and an harder-to-use alternative is exec (see here).

A little example to illustrate:

system("xeyes");
system("rm -rf $HOME"); /* never ever try this, really */
pmr
Have you included the quotes? ie system("xeyes"), NOT system(xeyes)
Noel M
@Noel I don't think he has. Thus my examples and clarification.
pmr
+1 for newbie humility :-)
JBRWilkinson