this is probably a really lame question for all you brainiacks
but thanks to assistance from people on this forum i've started
to experiment in accessing files in binary. But i dont understand
what the numbers are that i get from using fread(). What do these
long numbers represent??
for example if i use this code on a jpg file......
Code:
#include<stdio.h>
#include<stdlib.h>
main()
{
int r,i; /*r holds what i get from fread*/
FILE *ptr;
ptr=fopen("c:\\test.jpg","rb");
if(ptr==0){
printf("didnt work");
getchar();}
else
printf("it worked fine\n\n");
for (i=0;i<3;i++){
while(fread(&r,sizeof(r),1,ptr)!=1)
{
printf("Write error occurred\n");
getchar();
exit(1);
}
printf("%i\n", r);
}
fclose(ptr);
getchar();
return 0;
}
.....i get -520103681
1179258880
16795209
what do these mean?? What are they?
And if i change the integer r to a long, printf will not display anything!
can anybody tell me why!?!