till now i still don understand the different between stream and buffer. can anyone help to put light on that for me? thanks in advanced.
till now i still don understand the different between stream and buffer. can anyone help to put light on that for me? thanks in advanced.
A stream is a flow of continuous data. A buffer is a pool of data waiting to be read/wrote.
For example you stream video or audio over the internet. You can also buffer the stream by allowing a pool of the data to build up before "playing" it.
This is the same in programming. You can set up a buffer called "words." You can have two processes, one called reader and one called writer. You can write up to N number of characters to the buffer, and then reader can read up to how many characters were wrote by writer.
It's good to use a buffer because you can transfer blocks of data instead of transferring byte by byte or word by word.