<bdo id='auG6i'></bdo><ul id='auG6i'></ul>

    <i id='auG6i'><tr id='auG6i'><dt id='auG6i'><q id='auG6i'><span id='auG6i'><b id='auG6i'><form id='auG6i'><ins id='auG6i'></ins><ul id='auG6i'></ul><sub id='auG6i'></sub></form><legend id='auG6i'></legend><bdo id='auG6i'><pre id='auG6i'><center id='auG6i'></center></pre></bdo></b><th id='auG6i'></th></span></q></dt></tr></i><div id='auG6i'><tfoot id='auG6i'></tfoot><dl id='auG6i'><fieldset id='auG6i'></fieldset></dl></div>

    1. <small id='auG6i'></small><noframes id='auG6i'>

    2. <tfoot id='auG6i'></tfoot>
      <legend id='auG6i'><style id='auG6i'><dir id='auG6i'><q id='auG6i'></q></dir></style></legend>

      std::cout 不会打印

      时间:2023-05-24
    3. <tfoot id='qE1aL'></tfoot>
      • <small id='qE1aL'></small><noframes id='qE1aL'>

          • <bdo id='qE1aL'></bdo><ul id='qE1aL'></ul>

              <i id='qE1aL'><tr id='qE1aL'><dt id='qE1aL'><q id='qE1aL'><span id='qE1aL'><b id='qE1aL'><form id='qE1aL'><ins id='qE1aL'></ins><ul id='qE1aL'></ul><sub id='qE1aL'></sub></form><legend id='qE1aL'></legend><bdo id='qE1aL'><pre id='qE1aL'><center id='qE1aL'></center></pre></bdo></b><th id='qE1aL'></th></span></q></dt></tr></i><div id='qE1aL'><tfoot id='qE1aL'></tfoot><dl id='qE1aL'><fieldset id='qE1aL'></fieldset></dl></div>
                <tbody id='qE1aL'></tbody>

                <legend id='qE1aL'><style id='qE1aL'><dir id='qE1aL'><q id='qE1aL'></q></dir></style></legend>

                本文介绍了std::cout 不会打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                std::cout <<<有什么情况吗?你好" 不起作用?我有一个 c/c++ 代码,但是 std::cout 不打印任何内容,甚至不打印常量字符串(例如hello").

                Is there any circumstance when std::cout << "hello" doesn't work? I have a c/c++ code, however the std::cout doesn't print anything, not even constant strings (such as "hello").

                有什么方法可以检查 cout 是否能够/无法打开流?有一些成员函数,比如good()bad(),...但我不知道哪个适合我.

                Is there any way to check if cout is able/unable to open the stream? There are some member functions like good(), bad(), ... but I don't know which one is suitable for me.

                推荐答案

                确保刷新流.这是必需的,因为输出流是缓冲的,除非您自己手动刷新缓冲区,否则您无法保证何时刷新缓冲区.

                Make sure you flush the stream. This is required because the output streams are buffered and you have no guarantee over when the buffer will be flushed unless you manually flush it yourself.

                std::cout << "Hello" << std::endl;
                

                std::endl 将输出一个换行符并刷新流.或者,std::flush只是进行刷新.也可以使用流的成员函数来完成刷新:

                std::endl will output a newline and flush the stream. Alternatively, std::flush will just do the flush. Flushing can also be done using the stream's member function:

                std::cout.flush();
                

                这篇关于std::cout 不会打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:__FILE__、__LINE__ 和 __FUNCTION__ 在 C++ 中的用法 下一篇:程序仅在发布版本时崩溃——如何调试?

                相关文章

                最新文章

                <small id='QqmzY'></small><noframes id='QqmzY'>

                1. <legend id='QqmzY'><style id='QqmzY'><dir id='QqmzY'><q id='QqmzY'></q></dir></style></legend>

                  <tfoot id='QqmzY'></tfoot>

                    <i id='QqmzY'><tr id='QqmzY'><dt id='QqmzY'><q id='QqmzY'><span id='QqmzY'><b id='QqmzY'><form id='QqmzY'><ins id='QqmzY'></ins><ul id='QqmzY'></ul><sub id='QqmzY'></sub></form><legend id='QqmzY'></legend><bdo id='QqmzY'><pre id='QqmzY'><center id='QqmzY'></center></pre></bdo></b><th id='QqmzY'></th></span></q></dt></tr></i><div id='QqmzY'><tfoot id='QqmzY'></tfoot><dl id='QqmzY'><fieldset id='QqmzY'></fieldset></dl></div>
                      <bdo id='QqmzY'></bdo><ul id='QqmzY'></ul>