C++: What is a stream

前端 未结 4 1919
无人共我
无人共我 2020-12-13 00:05

I have been hearing about stream, more specifically file streams.

So what are they?

Is it something that has a location in the memory?

Is it somethin

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-13 00:27

    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.

    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.

提交回复
热议问题