Stream vs. Buffer

What is the diffence between the two, and what are their purpose?
A stream is a FIFO data structure. A buffer is random access.
A buffer is an array which contains some (raw) data
A stream is an abstraction of a buffer ( each stream has a buffer )

They have may uses
To clarify:

Is this definition by Wikipedia correct about buffers in C++?
"A buffer is a region of memory used to temporarily hold data while it is being moved from one place to another" -Wikipedia

And what about for streams?
"A stream is a source or sink of data, usually individual bytes or characters" - Wikipedia
Last edited on
The buffer definition seems OK, the stream one doesn't help that much... try this one: http://www.cplusplus.com/reference/iostream/
iostream classes from the C++ standard library do more that a basic stream. Consider a market data feed or internet radio.

A stream is a first in, first out data structure. It's not even necessarily point to point (consider broadcast or multicast).
Last edited on
Thanks,

Yeah, I see now, Cplusplus explains it better. Wiki says nothing about the stream being a physical device.
Topic archived. No new replies allowed.