Can I flush data implicitly?
<p>Is there a way to implicitly flush data to an output stream?</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
using namespace std;

#define log logstream 

int main()
{
  ofstream logstream("test.log");

  log &lt;&lt; "Test1" &lt;&lt; 123 &lt;&lt; endl;     // explicitly flushed
  log &lt;&lt; "Test2" &lt;&lt; 123;             // ?

  // Test2 not written, yet...

  cout &lt;&lt; "Check log file..." &lt;&lt; endl;
  int tmp;
  cin &gt;&gt; tmp;
}
</code></pre>

<p>I would like to be able to log without specifying the <code>&lt;&lt; endl</code> manipulator every time.</p>