title: Why is fflush() needed between input and output operations for file stream created by fopen()?
body: <p>Here is a quote from <a href="https://www.ibm.com/support/knowledgecenter/en/ssw_aix_71/com.ibm.aix.basetrf1/fopen.htm" rel="nofollow noreferrer">IBM</a> (also specified in C99 standard)</p>
  
  <blockquote>
    <p>When you open a file for update, you can perform both input and output
    operations on the resulting stream. However, an output operation
    cannot be directly followed by an input operation without an
    intervening fflush subroutine call or a file positioning operation
    (fseek, fseeko, fseeko64, fsetpos, fsetpos64 or rewind subroutine).
    Also, an input operation cannot be directly followed by an output
    operation without an intervening flush or file positioning operation,
    unless the input operation encounters the end of the file.</p>
  </blockquote>
  
  <p>Why this is necessary?</p>