i made some progress but i need your help again; i post the code that i wrote but before to do that, i wanted to
verify that the results were good, so i opened some file jpc, but also raw (that is the original image without any header) with an hex editor, where i could see the values of the byte written in hexadecimal format.
void ShowByte( char b , FILE * im)
for(int i = 7; i >= 0; --i)
if ( b & (1 << i) )
int main ()
FILE * pFile;
FILE * image;
if (pFile==NULL) perror ("Error opening file");
c = fgetc (pFile);
} while (c != EOF);
first thing strange (for me): if i declare the variable c as an unsigned char and if in the function ShowByte i declare b as unsigned char, the program never stops (infinite loop?)
secondly: i compare a very big file of 1 MB called image.raw and it seems that the program works, but the file txt generated (4 MB) contains less bytes than the original; the program i wrote cut a very huge amount data at some point that i cannot find.
for example, i create a file with 20 random values with an hex editor, and my program print (correctly) only the first 7 bytes of this file.
finally, if i use in input the file that i have to test, the image.jpc file, my program prints only the first byte!!
please can somebody help me??