This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: calling linux commands within the cpp program..


>Dear all,
>It is a big help if anyone give me a clue to call linux commands and their
>results within the cpp program..
>
>Thanks in advance..
>
>Koliya

Do you mean the system() function?

>From the man page...

NAME
       system - execute a shell command

SYNOPSIS
       #include <stdlib.h>

       int system (const char * string);

DESCRIPTION
       system()  executes a command specified in string by calling
/bin/sh -c string, and returns after the
       command has been completed.  During execution of the command, SIGCHLD
will be  blocked,  and  SIGINT
       and SIGQUIT will be ignored.

RETURN VALUE
       The  value returned is 127 if the execve() call for /bin/sh fails, -1
if there was another error and
       the return code of the command otherwise.

       If the value of string is NULL, system() returns nonzero if the shell
is available, and zero if not.

       system() does not affect the wait status of any other children.







Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]