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

posted @ 2011-12-27 13:58  规格严格-功夫到家  阅读(906)  评论(0编辑  收藏  举报