System call explained


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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s