M
mohi
hello everyone ,
i am trying to read a jpeg image through c++ but is unable to do so ,
presently i tried it with code in c as i use something like ;
FILE * fp=fopen("./x.jpg","rb");
int c;
do{
fread(fp,&c,sizeof(c));
if( c==(int) 0xFF23){
do.....
do....
}
printf("%x",c);
}
while(c!=EOF);
but the problem is the if condition never evalutes to true as i know
that according to the jpeg standard there should be market with value
0xFFD8 and others also .....and also the printf() of integer 'c' as
hex is never displayed it just displays a blank ..
what could be wrong ??
or what is the best way to read a binary file such as an image ??
thanks a lot
mohan gupta
i am trying to read a jpeg image through c++ but is unable to do so ,
presently i tried it with code in c as i use something like ;
FILE * fp=fopen("./x.jpg","rb");
int c;
do{
fread(fp,&c,sizeof(c));
if( c==(int) 0xFF23){
do.....
do....
}
printf("%x",c);
}
while(c!=EOF);
but the problem is the if condition never evalutes to true as i know
that according to the jpeg standard there should be market with value
0xFFD8 and others also .....and also the printf() of integer 'c' as
hex is never displayed it just displays a blank ..
what could be wrong ??
or what is the best way to read a binary file such as an image ??
thanks a lot
mohan gupta