I am reading and writing binary files. My program is translating the Carriage Return (0x0D) and Line Feed (0x0A) characters. How do I prevent this from happening?

Files opened in text mode will translate these characters for
    DOS. To read a file in binary mode, open it in binary mode.
    For example

      #include <stdio.h>
      main()
      {
         FILE *binary_fp;
         char buffer[100];

         binary_fp = fopen("MYFILE.BIN", "rb");

         fread(buffer, sizeof(char), 100, binary_fp);

                    :
      }

    The default file mode is text.



Learn More :