title: How to get file id from std::ofstream
body: <p>I want to use <code>flock(int fd, int operation)</code> on opened file, but <code>flock()</code> is <code>c</code> function. How to get <code>int fd</code> from <code>std::ofstream outfile</code> to use as argument for <code>flock()</code>. </p>
  
  <p>ps. I want <code>int fd</code> at <code>c++</code> style, I know that I can open file in <code>c</code> style and get it.  The question is about <code>c++ and flock()</code></p>
  
  <pre><code>std::ofstream outfile;
  outfile.open ( LOCKFILE, std::ios_base::trunc);
  </code></pre>
  
  <p>thanks</p>