I\'m trying to return an integer value from a child process.
However, if I use exit(1) i get 256 as the output. exit(-1)
Use WEXITSTATUS() to read the correct exit status of child
WEXITSTATUS()
Pass the status returned by waitpid() or wait()
waitpid()
wait()
e.g.:
int cstatus; wait(&cstatus); printf("Child exit status : %d\n", WEXITSTATUS(cstatus));