title: C++ cout and cin buffers, and buffers in general
body: <p>Can someone explain the concept of buffers a bit more explicitly? I understand that buffers are data structures where characters are stored, and the place where the data is to be read from. What is the idea of flushing buffers? </p>
  
  <p>When a buffer is flushed, is this referring to the act of writing the characters stored in it?</p>
  
  <p>From the text:</p>
  
  <pre><code>To avoid the overhead of writing in response to each output request, the library uses the 
  buffer to accumulate the characters to be written, and flushes the buffer, by writing its
  contents to the output device, only when necessary. By doing so, it can combine several 
  output operations into a single write.
  </code></pre>
  
  <p>When referring to 'flushing' that almost makes it sound as if the buffer is being written but also erased at the same time. Just speculation. </p>
  
  <p>So, in order to be wrote to view on a screen the buffer flush is required?</p>
  
  <pre><code>When our program writes its prompt to cout, that output goes into the buffer associated
  with the standard output stream. Next, we attempt to read from cin. This read flushes
  the cout buffer, so we are assured that our user will see the prompt.
  </code></pre>
  
  <p>Here, it sounds as if the by using 'endl' at the end it tells the system it needs to write immediately(implying otherwise is wouldn't?) What is endl is not used?</p>
  
  <pre><code>Writing the value of std::endl ends the line of 
  output, and then flushes the buffer, which forces the system to write to the output 
  stream immediately.
  </code></pre>