endl and flushing the buffer

前端 未结 5 627
被撕碎了的回忆
被撕碎了的回忆 2020-11-27 14:55

In the C++ primer book, in chapter (1), it mentions the following:

endl is a special value, called a manipulator, that when written t

5条回答
  •  醉梦人生
    2020-11-27 15:18

    Output is generally buffered before it's written to the intended device. That way, when writing to slow to access devices(like files), it doesn't have to access the device after every single character.

    Flushing means emptying the buffer and actually writing it to the device.

提交回复
热议问题