Windows 退出码 规格严格

exit(int status)函数是中断当前的进程,返回到当前进程的调用者,即系统,
并且还返回给系统一个退出码,即ststus;
我们可以利用DOS中的程序异常结束的返回值errorlevel来获得;
如:
程序exitcode.c
#include <stdlib.h>
void main( void )
{
      exit( 10 );
}

然后写一个批处理文件getexitcode.bat
exitcode.exe
echo %errorlevel%

先编译C程序,然后执行批处理文件就可以发现我们得到了退出码了;

http://blog.sina.com.cn/s/blog_5f18ff880100h52j.html

原文地址:https://www.cnblogs.com/diyunpeng/p/2303476.html