fread problem

Started by
1 comment, last by LordLethis 21 years, 4 months ago
I''m using fread to read in a file. But after about 800 bytes it tells me that it''s reached the end of the file. But as a matter of fact, the file size is 8.71 KB... How is this possible?? The file consists of a header, followed by the data.
  
//HEADER

typedef struct tagHEADER
{
int type;
int bpp;
int nHeight;
int nWidth;
int Size;
} HEADER, *LPHEADER;

//DATA

typedef struct tagRGBA
{
unsigned char a,b,g,r;
} RGBA, *LPRGBA;
  
Because of this, I don''t no if my program actually would work. It should compress a bitmap using RLE, with alpha channel as run length. But please, don''t tell me to use another function, cuz I like this one better than the C++ stream classes
[My Lousy Page | Kings Of Chaos | Vampires | [email=lordlethis@hotmail.com]email.me[/email]]
Advertisement
Have you opened it to read in binary? I think in Windows it defaults to text, everywhere else its binary. If you should be reading in binary and you open it for text it will confuse the end-of-file symbol with something else and think the file is finished.
Yeah, thanks, it works :D:D
[My Lousy Page | Kings Of Chaos | Vampires | [email=lordlethis@hotmail.com]email.me[/email]]

This topic is closed to new replies.

Advertisement