且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从 main() 返回大于 8 位的数字?

更新时间:2023-02-11 16:36:48

进程的退出状态大小为 8 位.无法通过正常方式返回更大的退出状态.如果您想输出一个大于 255 的数字,例如,您可以使用 write 系统调用将其打印到 stdout(文件描述符 1).

The exit status of a process is 8 bits in size. It is not possible to return a larger exit status by normal means. If you want to output a number larger than 255, you could for example print it to stdout (file descriptor 1) with a write system call.