Hello Everyone ,
I have written a simple piece of code for reading an Image file(.png) in c but this code doesn't seem to work properly.Can anyone help me solve this problem of reading an image file in C ? Code I have written is :-
FILE *file;
char ch;
file=fopen("img.png","r");
while((ch=fgetc(file))!=EOF )
printf("%c ",ch);
When running this code , each time I'm getting the same output as
ë P N G
Even if the file size is 2022bytes .Why am I not getting 2022 bytes ? Instead I'm getting only these 4 bytes as output.Please !! help.