且构网

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

命令行应用程序中的返回值行为

更新时间:2023-11-03 22:11:46

对不起,我不要以为我理解您的问题.
您是否希望命令窗口在返回数字值时自动打印消息?
这与C ++无关,但与命令外壳无关.如果返回一个值,那么这就是C ++应用程序的结尾. C ++运行时除了返回它外不执行任何操作.
尝试在讨论命令外壳程序或Windows Shell的论坛或新闻组中进行询问.

最简单的方法是自己进行翻译然后在命令行上打印正确的消息.
这样,您还可以打印有助于用户诊断问题的上下文信息.
Sorry I don't think I understand your question.
Do you want the command windows to automatically print messages if you return a numerical value?
This has nothing to do with C++, but with the command shell. If you return a value, then that's the end of your C++ app. The C++ runtime doesn't do anything with it except returning it.
Try asking in a forum or newsgroup that discusses the command shell or windows shell.

The easiest thing to do is to do the translation yourself and then print the correct message to the command line.
That way you can also print contextual information that will help the user diagnose the problem.