title: C++ buffered stream IO
body: <p>I understand that by default all stream IO supported by C++ is buffered.</p>
  
  <p>This means that data to be output is put into a buffer till it is full and then sent to the output device, similarly for input, the data is read once the buffer is empty...all this is done so that number of expensive system calls could be minimized.</p>
  
  <p>But how to verify this behavior in action. I mean consider the following code</p>
  
  <pre><code>int main()
  {
      cout &lt;&lt; "Hello world\n";
      return 0
  }
  </code></pre>
  
  <p>Where does buffering come into picture here ? I know there is buffering happening, but how to explain it? The output is seen instantly on the screen, so what could be a code example to actually see buffered I/O in action ?</p>