C ++:什么是流 [英] C++: What is a stream
问题描述
我一直在听说流,更具体地说是文件流。
I have been hearing about stream, more specifically file streams.
那是什么?
是包含数据的东西吗?
是吗?仅仅是文件和对象之间的连接?
Is it just a connection between a file and an object?
任何帮助将不胜感激
推荐答案
术语流是一种构造的抽象,它允许您发送或接收未知数量的字节。隐喻是水流。您可以获取数据,也可以根据需要发送。例如,将此与具有固定的已知长度的数组进行比较。
The term stream is an abstraction of a construct that allows you to send or receive an unknown number of bytes. The metaphor is a stream of water. You take the data as it comes, or send it as needed. Contrast this to an array, for example, which has a fixed, known length.
使用流的示例包括读取和写入文件,在计算机上接收或发送数据。外部连接。但是术语 stream 是通用的,对具体实现一无所知。
Examples where streams are used include reading and writing to files, receiving or sending data across an external connection. However the term stream is generic and says nothing about the specific implementation.
这篇关于C ++:什么是流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!