title: Tried and true simple file copying code in C?
body: <p>This looks like a simple question, but I didn't find anything similar here.</p>
  
  <p>Since there is no file copy function in C, we have to implement file copying ourselves, but I don't like reinventing the wheel even for trivial stuff like that, so I'd like to ask the cloud:</p>
  
  <ol>
  <li>What code would you recommend for file copying using fopen()/fread()/fwrite()?
  
  <ul>
  <li>What code would you recommend for file copying using open()/read()/write()?</li>
  </ul></li>
  </ol>
  
  <p>This code should be portable (windows/mac/linux/bsd/qnx/younameit), stable, time tested, fast, memory efficient and etc. Getting into specific system's internals to squeeze some more performance is welcomed (like getting filesystem cluster size).</p>
  
  <p>This seems like a trivial question but, for example, source code for CP command isn't 10 lines  of C code.</p>