Home  >  Q&A  >  body text

c++缓冲区是怎么回事的哦?是怎么把输入输出存入缓冲区的哦?平时直接cout就打印结果了啊,没体会到怎么属于缓冲了的

ringa_leeringa_lee2714 days ago560

reply all(2)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 13:19:13

    Cout is a row-level buffer, and it will be flushed once it encounters a newline character. However, the cout object will also be flushed once when it is destroyed. In your example, the cout object needs to be destroyed once before returning 0.
    In terms of cerr, I have forgotten what it said in APUE. After debugging, I found that there is no buffering...

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 13:19:13

    You will experience it when you are multi-threaded. If the cache is not cleared, the logs of thread A may be printed on thread B

    reply
    0
  • Cancelreply