How can I get what my main function has returned?

前端 未结 5 1846
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 15:28

In a C program if we want to give some input from terminal then we can give it by:

int main(int argc, char *argv[])

In the same way, if we

5条回答
  •  执笔经年
    2020-12-04 15:59

    In DOS/Windows you can use errorlevel within a batch file

    executable optional arguments
    if errorlevel 4 goto LABEL4
    if errorlevel 3 goto LABEL3
    if errorlevel 2 goto LABEL2
    if errorlevel 1 goto LABEL1
    :SUCCESS
    echo SUCCESS; errorlevel 0
    goto :eof
    :LABEL1
    echo FAILURE; errorlevel 1
    goto :eof
    :LABEL2
    echo FAILURE; errorlevel 2
    goto :eof
    REM ...
    

    Just remember to check from the greatest to the lowest because if errorlevel 42 really means "if errorlevel is 42 or greater"

提交回复
热议问题