Exit Codes from system() not as expected

后端 未结 3 755
我在风中等你
我在风中等你 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 20:00

    0 and 512 are the termination status of the command.

    If the command executes successfully, it returns a 0 value, otherwise, it returns a non-zero value. And this non-zero value is various in different OSs. In my mac os, the return value of the second system command is 256.

    You can also get answer from this question `ls` exit status.

提交回复
热议问题