- Reading data from a file on the computer's disk into the program
- Saving the results of the program into a file on the disk for future use
The stream can be thought of as a line of characters following in a specific order in one direction without ever changing their order.
- Only the first character of the stream can be read from the stream ( with the operation get() )
- Writing can only be done after the last character in the stream( with the operation put() )
- If the user types "abcdef" on a keyboard undoubtedly the program gets the same characters in the same order from the input stream(cin)
- If the program writes characters into a stream connected to a file it is desirable that the characters are saved in the same order they were written into the stream
A stream is usually connected to a file, the screen or the keyboard. However, streams can also be used to connect two programs to each other. The interesting thing is that streams can always be handled in the same way, regardless of what they happen to be connected to.
Reference: cplusplus, msdn, exforsys
No comments:
Post a Comment