system() exit code
From: Stephen Morgan (nospam_at_nospam.com)
Date: Fri, 14 May 2004 18:18:03 -0500
This script, call it "st"
exits with exit code of 123, as it should. However, this C code:
rc = system("/root/yada/yada/st");
printf("return code is: %d\n", rc);
prints "return code is: 31488" which is 123 shifted left 8 bits. I've
tried this with a few values and the 8-bit shift is consistent.
Is this normal behavior for the system() function, and if so, is it
documented somewhere? Before I commit to code that relies on this behavior,
I'd like to know that it's reliable :-)
Thanks for your help,