Archived

This topic is now archived and is closed to further replies.

LordLethis

fread problem

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites