For some reason, whenever the program reads 1A in hex, 26 in dec it is reading it as EOF. I have it print out the character and, sure enough, it prints -1. I don't get it. Other programs are detecting EOF just fine. Here's the culprit code:
Code:
new_byte = fgetc(_source);
while(new_byte != EOF){
decompress(new_byte, bit);
for(i=0; i < (8/bit); i++){
fputc(_new_pixels[i], _dest);
}
printf("%d: ", j);
j++;
new_byte = fgetc(_source);
printf("%d\n", new_byte);
}
That is supposed to loop through over 8000 times, but it gets to byte number 206 and hit EOF. Here's the end of the output:
Code:
200: 0
201: 0
202: 15
203: 255
204: 139
205: 47
206: -1
Byte number 206 is 26, not -1
I changed byte 206 to 27, then it stopped on the next 26 later in the file.
Any ideas?
Thanks