Hi, 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.
1) the code must work for c, c++
2) i am compiling with multiple compilers.
3) I am reading and writing to the files by using the functions fread() and fwrite()
4) fread() and fwrite() handle bytes, not strings.
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.
Unfortunately, fread() seems to store CRLF as \n (I think), and whatever is written by fwrite() is compiler-dependent.
How do i approach this problem?
Thanks.