What translation occurs when writing to a file that was opened in text mode that does not occur in binary mode? Specifically in MS Visual C.
unsigned char buffer[256]; for (int i = 0; i < 256; i++) buffer[i]=i; int size = 1; int count = 256;
Binary mode:
FILE *fp_binary = fopen(filename, 'wb'); fwrite(buffer, size, count, fp_binary);
Versus text mode:
FILE *fp_text = fopen(filename, 'wt'); fwrite(buffer, size, count, fp_text);
I believe that most platforms will ignore the ‘t’ option or the ‘text-mode’ option when dealing with streams. On windows, however, this is not the case. If you take a look at the description of the fopen() function at: MSDN, you will see that specifying the ‘t’ option will have the following effect: