I am writing a program that prints out the Firefox cookies.sqlite file.
int printfile(FILE* cookiesfile)
{
int c;
//fseek(cookiesfile,0x18260,SEEK_SET);
do{
c=fgetc(cookiesfile);
printf("%c",c);
}while(c != EOF);
printf("\n\n%x",c);
if (ferror(cookiesfile) != 0)printf("\nchareror!\n");
return 0;
}
The code returns EOF at various points before the end of the file. Opening the file in a hex editor or notepad shows that the file is much larger. The EOF always appears at the same points. Skipping past these points, data is read until the next EOF. Characters that the EOF occurs on have often been fgot previously without any problem (i.e. 0x1a, 0x13).
Checking the result from ferror() does not help (as no error is present).
I am not sure how to proceed in my debugging process, can someone lead me in the right direction?
feofto read a binary file .I have modify my code, Since I don't have you file , hope you can try my code. and give me a result. - Lidong Guo