title: ofstream exception handling
body: <p>Deliberately I'm having this method which writes into a file, so I tried to handle the exception of the possiblity that I'm writing into a closed file:</p>
  
  <pre><code>void printMe(ofstream&amp; file)
  {
          try
          {
              file &lt;&lt; "\t"+m_Type+"\t"+m_Id";"+"\n";
          }
          catch (std::exception &amp;e)
          {
              cout &lt;&lt; "exception !! " &lt;&lt; endl ;
          }
  };
  </code></pre>
  
  <p>But apparently std::exception is not the appropriate exception for a closed file error because I deliberately tried to use this method on an already closed file but my "exception !! " comment was not generated.</p>
  
  <p>So what exception should I have written ??</p>