Exit Codes from system() not as expected

后端 未结 3 757
我在风中等你
我在风中等你 2021-01-18 19:27

The system() function seems to be returning 128 times the exit code I get from the process it\'s evoking.

From the man page:

RETURN VALUE

3条回答
  •  一整个雨季
    2021-01-18 19:42

    From POSIX system(3):

    If command is not a null pointer, system() shall return the termination status of the command language interpreter in the format specified by waitpid().

    To get the return code, you need to use the WEXITSTATUS macro.

提交回复
热议问题