title: Creating .dat file (fstream) c++
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;cstdlib&gt;
  using namespace std;
  
  int main() {
  
  fstream inOutGrades( "grades.dat", ios::in | ios::out | ios::binary );
  
  if ( !inOutGrades ) {
      cerr &lt;&lt; "The file could not be opened." &lt;&lt; endl;
      exit(1);
  }
  
  return 0;
  }
  
  //Output is 
  The file could not be opened.
  </code></pre>
  
  <p>I've tried this program wioth QT and Code::blocks at windows 7 and lubuntu.They all can't create the grades.dat file.</p>