wrong bytes?

Started by
2 comments, last by pex22 18 years, 10 months ago
Hi. im having a problem. i dont know if my image file (my own format) is 64 bytes or 6.10kb. in my program it says 64 bytes (and print the file):
long i=0;
while (!feof(file))
{
i++;
printf("%c",fgetc(file));
}
printf("\n%ld Bytes.",i-(i!=0));
and in windows explorer it says 6.10kb. also, i cant find the header (the file begin with PSG) in notepad. but i do find it in my program. in the file i've used hex, chars, compressions, bgcolor, and a header of course. the weird is, when i test it with a small program that contains background and many pixels only- it works well in both notepad and my program (compiler: TC3, windows: XPro). what is going on? (tell me if a source code is needed, the code is just fine. i used longs and no ints). thanks, pex.
pex.
Advertisement
How are you opening the file in your code?

I doubt it could account for such a large discrepancy but are sure that the file is opened in binary mode?
binary mode. right i forgot it. thanks!
pex.

This topic is closed to new replies.

Advertisement