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)
See the documentation. First use WIFEXITED to determine whether it terminated normally (possibly with non-zero status). Then, use WEXITSTATUS to determine what the low-order 8 bits of the actual status are.
WIFEXITED
WEXITSTATUS