title: open with O_RDWR -- how to overwrite?
body: <p>I want to read a file and change its content and write it back to the file.</p>
  
  <p>I use <code>open</code> to read a file as follows:</p>
  
  <pre><code>bfd = open(m_file_name.c_str(), O_RDWR)
  </code></pre>
  
  <p>But when I write, it is kinda append it to the old one. How can I overwrite it?</p>