Jump to content
  • Advertisement


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


fread problem

This topic is 5749 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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.

typedef struct tagHEADER
int type;
int bpp;
int nHeight;
int nWidth;
int Size;


typedef struct tagRGBA
unsigned char a,b,g,r;
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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!