Even in Binary or Text mode it is working(image,document,...). Then what is the real use of these mode and how to use them.
#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *fp;
unsigned char buffer[756396];
fp=fopen("ref.jpg","r"); //rb
if(fp==NULL)
{
printf("File not present");
exit(0);
}
else
fread(buffer,sizeof(buffer),1,fp);
fclose(fp);
fp=fopen("ref1.jpg","w"); //wb
if(fp==NULL)
{
printf("File can not be created");
exit(0);
}
else
fwrite(buffer,sizeof(buffer),1,fq);
fclose(fp);
return 0;
}
output
Above code create a copy of an image
I want to know the real time application of where and when to use them.