For how to check your return code from another C program, you can use system
from the standard library to call the executable, and WEXITSTATUS
from sys/wait.h to get the return value from the result of system.
Basicallly, it's what is said in the latter half of user25148's answer above. Look at std::system's man pages for your system, and the man pages for wait (linux).
See this answer from another question for a better explanation and good example: https://stackoverflow.com/a/20193792/21742246