In the most basic form, a stream is a construct that supports the following interfaces:
Although in many cases, a stream corresponds to a file, it is not always the case. For example, in C++, there is a way to associate a stream with a character string. By writing to this kind of stream, the characters are actually appended to the end of a string.
Even when a stream corresponds to a “file”, it can be correspond to a conventional file, or special files. Special files make it possible to use the stream interface to communicate with hardware devices such as the serial port, or communicate with resources such as a network connection.