title: How can I copy files in C without platform dependency?
body: <p>It looks like this question is pretty simple but I can't find the clear solution for copying files in C without platform dependency.</p>
  
  <p>I used a system() call in my open source project for creating a directory, copying files and run external programs. It works very well in Mac OS X and other Unix-ish systems, but it fails on Windows. The problem was:</p>
  
  <pre><code>system( "cp a.txt destination/b.txt" );
  </code></pre>
  
  <ul>
  <li>Windows uses backslashes for path separator. (vs slashes in Unix-ish)</li>
  <li>Windows uses 'copy' for the internal copy command. (vs cp in Unix-ish)</li>
  </ul>
  
  <p>How can I write a copying code without dependency?</p>
  
  <p>( Actually, I wrote macros to solve this problems, but it's not cool. <a href="http://code.google.com/p/npk/source/browse/trunk/npk/cli/tests/testutil.h">http://code.google.com/p/npk/source/browse/trunk/npk/cli/tests/testutil.h</a>, L22-56 )</p>