title: How to open a file which overwrite existing content
body: <p>I try to open a file like this in linux. It will over-write an existing one if exits. That is what I want.</p>
  
  <pre><code>fout = open(out_file_name, O_WRONLY | O_CREAT, 644);
  </code></pre>
  
  <p>However, if the existing is 1024 bytes, when I open in above way and write 800 new bytes.
  I still see the 224 bytes at the end of previous content. </p>
  
  <p>How can I make it just have the 800 bytes that I have been written?</p>