system function return value

system function returns int type in linux c.

example: int ret;

system will get the return value of fxn, but it is obtained by shifting 8 bit to right. (it means, it contains return value in higher byte). then what type of information is in lower byte?

Shifting 8 bits to the right is not the documented way to obtain the return value from the return code of system(). Both Linux documentation (man 3 system) and POSIX itself only document WEXITSTATUS(ret).

The other bits must be holding the information that can be extracted with the other W... macros (WIFSIGNALED etc)
Topic archived. No new replies allowed.