system function
Hello,
I am using the system() function to execute a shell command into my C program. But I want to check if the program given to the system() function is valid ,if not, I will print "not found" on the screen. So I want to do this by checking the exit code of the program executed. If the exit code equals 0, then, the program executed successfully, else, the program had errors when executing.
So ,how can I check an exit code of a program in C?
Thanks in advance.
|