小编bde*_*den的帖子

C++ cout和cin缓冲区,以及一般的缓冲区

有人可以更明确地解释缓冲区的概念吗?我知道缓冲区是存储字符的数据结构,以及从中读取数据的位置.冲洗缓冲区的想法是什么?

刷新缓冲区时,这是指写入存储在其中的字符的行为吗?

从文字:

To avoid the overhead of writing in response to each output request, the library uses the 
buffer to accumulate the characters to be written, and flushes the buffer, by writing its
contents to the output device, only when necessary. By doing so, it can combine several 
output operations into a single write.
Run Code Online (Sandbox Code Playgroud)

当提到"刷新"时,几乎使其听起来好像缓冲区正在写入但同时也被擦除.只是猜测.

那么,为了写入屏幕上的视图需要缓冲区刷新?

When our program writes its prompt to cout, that output goes into the buffer associated
with the standard output stream. Next, we attempt …
Run Code Online (Sandbox Code Playgroud)

c++ buffer flush

16
推荐指数
2
解决办法
8796
查看次数

标签 统计

buffer ×1

c++ ×1

flush ×1