现在的位置: 首页 > 综合 > 正文

[Tip: main return value]Return value to command line

2013年06月16日 ⁄ 综合 ⁄ 共 326字 ⁄ 字号 评论关闭

As we know, for main, it's so common to see it looks like below:

int main()

{

// do your work.

return 0;

}

At least for a console application, the returned value 0 here can be consumed later in script tool using below lines (into a bat file):

@echo off
ConsoleApplication1.exe arg1 arg2
echo Result is “%errorlevel%”
pause

 

Here, “%errorlevel%” will get 0 which is main function's return value.

抱歉!评论已关闭.