title: Why does ofstream("log.txt", ios::app|ios::trunc); always fail?
body: <p>The following code was compiled with VC++ Nov 2012 CTP on Windows 7 x64.</p>
  
  <pre><code>#include &lt;fstream&gt;
  
  using namespace std;
  
  int main()
  {
      ofstream fout("log.txt", ios::app|ios::trunc);
      if (!fout)
      {
          cout &lt;&lt; "An error occurred!" &lt;&lt; endl; // Always go here! Why?
      }
  }
  </code></pre>
  
  <p><a href="http://en.cppreference.com/w/cpp/io/ios_base/openmode" rel="noreferrer">The cppreference.com website</a> doesn't say that <code>ios::app</code> cannot be combined with <code>ios::trunc</code>.</p>
  
  <p>What are the <strong>exact</strong> semantics of <code>ios::app</code> and <code>ios::trunc</code>?</p>