title: Check if std::fstream is in write or read mode
body: <p>I need to check whether a <code>std::fstream</code> opened a file in read and/or write mode.</p>
  
  <p>So far, I found <code>iosbase::openmode</code>, but I don't think I can access it.</p>
  
  <p>Is there any other way?</p>