C++: What is a stream

前端 未结 4 1913
无人共我
无人共我 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条回答
  •  一向
    一向 (楼主)
    2020-12-13 00:09

    IOStreams are a front-end interface (std::istream, std::ostream) used to define input and output functions. The streams also store formatting options, e.g., the base to use for integer output and hold a std::locale object for all kind of customization. Their most important component is a pointer to a std::streambuf which defines how to access a sequence of characters, e.g., a file, a string, an area on the screen, etc. Specifically for files and strings special stream buffers are provided and classes derived from the stream base classes are provided for easier creation. Describing the entire facilities of the IOStreams library can pretty much fill an entire book: In C++ 2003 about half the library section was devoted to stream related functionality.

提交回复
热议问题