Reputation: 3513
I'm trying to understand I/O Streams in more detail, and for this, I'm reading the "The C++ Programming Language" by Stroustrup, 4th edition. Right at the beginning of Chapter 38, page 1073, one finds the following two statements:
An ostream converts typed objects to a stream of characters (bytes).
An istream converts a stream of characters (bytes) to typed objects.
Aren't the words ostream and istream switched in the explanation given above?
Upvotes: 0
Views: 52
Reputation: 9570
Outputting is receiving some typed objects from the program (a char
'c', an int
123, a float
123.45) and encoding them into a sequence of bytes, sent somewhere (to a printer, to a file, to the console...).
Inputting is receiving a stream of bytes from somewhere ant extracting some typed data from it.
The images are correct.
Upvotes: 0
Reputation: 254631
No. ostream
"outputs" from arbitrary types to character sequences, and istream
"inputs" to arbitrary types from character sequences, just as described.
Upvotes: 1