title: File IO, Handling CRLF
body: <p>I am writing a program that takes a file and splits it up into multiple small files of a user specified size, then join the multiple small files back again.</p>
  
  <ol>
  <li><p>the code must work for C and C++</p></li>
  <li><p>I am compiling with multiple compilers.</p></li>
  <li><p>I am reading and writing to the files by using the functions <code>fread()</code> and <code>fwrite()</code></p></li>
  <li><p><code>fread()</code> and <code>fwrite()</code> handle bytes, not strings.</p></li>
  </ol>
  
  <p>The problem I am having pertains to CRLF. If the file I am reading from contains CRLF, then I want to retain it when i split and join the files back together. If the file contains LF, then i want to retain LF. </p>
  
  <p>Unfortunately, <code>fread()</code> seems to store CRLF as <code>\n</code> (I think), and whatever is written by <code>fwrite()</code> is compiler-dependent.</p>
  
  <p>How do I approach this problem?</p>