Printer - yes. Mouse/trackball, not so much. A stream is the source or destination of a series of data, either characters, or in the case of binary files, a sequence of bytes that represent memory content. Since it's an abstraction, you can operate on any stream in the same manner - it doesn't matter if you're reading characters from a console (keyboard) with cin or from a file with an ifstream object.
vmanes
Posting Virtuoso
1,914 posts since Aug 2007
Reputation Points: 1,268
Solved Threads: 228
Ok, What you want is a bit informal explanation.
Think of stream as a virtual device (presumably a printer). You are give functions to read/write to that device. You actually don't differentiate if that device is actually your monitor, your printer, the hard disk, or the RAM. What you know is that if you have to write or read any of these devices, you can use the same set of functions to do so.
In C++, there are filestream (which can be assume to be a device as hard disk), memorystream( which can be assume to be a device as your RAM), iostream (which can be assume to be a device as monitor for printing and k/b for reading).
You can use the same >> and << operators to read/write from a file, memory, monitor/keyboard, without knowing the specification of each. Thus you save remembering exclusive function for each of these devices.
siddhant3s
Practically a Posting Shark
816 posts since Oct 2007
Reputation Points: 1,486
Solved Threads: 140
Tell me something: Can you read words or text from mouse? no.
Well this was very vague conclusion though,
Mouse streams are possible. But, mouse is an optional component of a computer. C++ trace back to those years computer when monitors were new technology!!
So, of course you can read mouse (the location of its pointer) and write mouse (set the position of pointer) but that would be a OS specific issue. Each OS will give different control over mouse. Hence they are not part of standard streams. They are not shipped with every compiler.
Note that when you are well verse in C++, you would be able to create your own mouse stream on WIndows( or perhaps Linux)!!
siddhant3s
Practically a Posting Shark
816 posts since Oct 2007
Reputation Points: 1,486
Solved Threads: 140