I recently got stuck with this problem, when i do a system (“/bin/mytestexe -s 13”)call. it would return a 100 insted of a 1, many forums do give a lot of vague explanations why this happens. the the answer to this problem can be found in the WAIT.h file. If you go thorough this file we will get to know that. The return is 4bytes long not 8…
2byte code return, 2 byte execution info
1) bytes code return:
It shows the value my code has returned. my function (executable) used to return a 1. this makes the output 100.
2) bytes execution info
It shows the info of the command, for example the compiler could not find “/bin/mytestexe” it would return a 127 error if it cant the the file. Refer (sys/wait.h) for more details efinisions of the error codes.