title: fstream not creating new file
body: <p>I am trying to learn dynamic file access. My code is as follows:</p>
  
  <pre><code>int main()
  {
      dtbrec xrec; // class object
      fstream flh;
  
      // Doesn't create a new file unless ios::trunc is also given.
      flh.open("database.txt", ios::in | ios::out | ios::binary);
  
      flh.seekp(0,ios::end);
      xrec.getdata();
      flh.write((char*)&amp;xrec, sizeof(dtbrec));
  
      flh.close();
  }
  </code></pre>
  
  <p>I thought that <code>fstream</code> by default creates a new file 'database.txt' if it doesn't exist. Any ideas as to what could be wrong?</p>