title: do fread and fwrite have failure? how to handle this?
body: <p>when I read from a file using fread (C language), the return value of fread sometimes would be 0.</p>
  
  <p>As manual suggested:</p>
  
  <blockquote>
    <p>fread() and fwrite() return the number of items successfully read or
    written</p>
  </blockquote>
  
  <p>do I have to write code like this?</p>
  
  <pre><code>int bytes_read;
  while((bytes_read = fread(buffer, sizeof(int), 1, fp)) == 0) {
  
  }
  </code></pre>
  
  <p>do we always have to check whether fread or fwrite succeeded?</p>