“冲洗河流"是什么意思? [英] What is meant by 'flushing the stream'?

查看:43
本文介绍了“冲洗河流"是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经读过,对于c ++中的新行,'\ n'比'endl'更可取,因为'endl'会插入新行并刷新流.请告诉我什么在冲洗水流?

I've read that '\n' is preferred over 'endl' for new line in c++ because 'endl' inserts new line and flushes the stream. Please tell me what is flushing the stream ?

推荐答案

刷新流可确保输出已写入该流的所有数据,包括清除可能已缓冲的任何数据.

Flushing a stream ensures that all data that has been written to that stream is output, including clearing any that may have been buffered.

某些流被缓冲以提高性能,例如写入磁盘的流可能会缓冲,直到内容达到块大小为止.

Some streams are buffered to aid performance, e.g. a stream writing to disk may buffer until the content reaches a block size.

这篇关于“冲洗河流"是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆