last day (15 days later) » 

4:17 PM
3
A: C++: What is a stream

Jonathan WoodThe term stream is a general abstraction (concept) of any construct that allows you to simply send any number of bytes, or to receive any number of bytes. More specifically, it depends entirely on the type of stream and how it's implemented. The more general concept says nothing about whether it...

 
So it is like a "river stream" that flows from source to destination. And the stream is the river itself
 
Conceptually, you could say it that way.
 
So i can consider a stream as the thing that brings (for example) data from the console to the variabel
 
Sounds right...
 
If it is simply something like that, How can it have a newline charecter stuck in it?
 
4:17 PM
What is "stuck in it"? There is nothing about the general concept of streams that defines what kind of data can be transferred or how you transfer it. If you mean stuck as in it won't flow with the stream, then that sounds like a bug. I don't have enough information to say.
 
I like what you said and thank you,
 
Most streams that we use on a day to day basis are ASCII or UTF8 text streams, which means the bytes are interpreted as characters. Not all characters are letters and numbers, space, newline, and even a bell sound are characters as well, and a stream can carry them like any other character.
 
Hello :)
text files; these are treated as streams of text,
 
@MohamedAhmedNabil right
 
This was the thing that got me mixed up
how is a text file treated like that
 
4:19 PM
@MohamedAhmedNabil a text file can be seen as a series of characters, including newlines and spaces and such.
A stream simply streams these characters one at a time into your program.
 
But a text file itself, isnt actually a stream?
 
@MohamedAhmedNabil right, a text file is simply a source of data.
 
:D Thank you
 
no problem
 
So the book was wrong?
or did i misunderstand?
 
4:21 PM
It's very common for people to speak as if the file were a stream. Like you might say "I clean my room" when in reality, it's not the room you're cleaning, but the stuff in the room.
Or sorting a box of papers. That's probably a better analogy. You sort the papers in the box, you can't really "sort a box" by itself.
 
You are awesome
I dont know where you show up from but Thank you
 
I happened to randomly find your question, and then saw the chain of comments, and wanted to help, and saw the "continue in chat" link, so I clicked it :D
 

last day (15 days later) »