Hi, I am using system function in C code to invoke cp command. I want to know whether it got executed successfully or not?
+6
A:
Use system() function. It returns the status of command executed. If this is 0, then it would seem this is successfull.
Patrick MARIE
2010-02-15 08:07:56
+3
A:
Should be enought to check the return value of system
call.
From man system
on Mac:
The system() function returns the exit status of the shell as returned by waitpid(2), or -1 if an error occurred when invoking fork(2) or waitpid(2). A return value of 127 means the execution of the shell failed.
stefanB
2010-02-15 08:08:19