title: The consequences and pros/cons of flushing the stream in c++
body: <p>I have recently read an article which stated that using <code>\n</code> is preferable to using <code>std::endl</code> because <code>endl</code> also flushes the stream.<br/>
  But when I looked for a bit more information on the topic I found a site which stated:</p>
  
  <blockquote>
    <p>If you are in a situation where you have to avoid buffering, you can use std::endl instead of ‘\n’
    <BR/></p>
  </blockquote>
  
  <p>Now here comes my question: In which situation is it preferable <strong>not</strong> to write to the buffer? Because I only saw advantages of that technique. Isn't it also safer to write to the buffer? Because it is smaller than a hard drive it will get overwritten faster than data that is stored on the HD (I am not sure if this is true).   </p>