| www.delorie.com/archives/browse.cgi | search |
| From: | Nick <jp_prongs AT yahoo DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: New Moron on the Block :) |
| Date: | Sat, 06 Oct 2001 13:45:18 -0400 |
| Organization: | MindSpring Enterprises |
| Lines: | 30 |
| Message-ID: | <3BBF432E.6B6F9960@yahoo.com> |
| References: | <34539894 DOT 0110031004 DOT 1133f1ea AT posting DOT google DOT com> <8af9182 DOT 0110040819 DOT 732e3eb0 AT posting DOT google DOT com> |
| NNTP-Posting-Host: | a5.f7.99.32 |
| Mime-Version: | 1.0 |
| X-Server-Date: | 6 Oct 2001 17:45:31 GMT |
| X-Mailer: | Mozilla 4.75 [en] (Win98; U) |
| X-Accept-Language: | en |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
> > I have tried to overload _read, so that it will read WORDS, DWORDS or
> > BYTES like that
> >
> > _read(WORD Word)
> > {
> > char buffer[2];
> > int blah;
> > _read(blah, buffer, 2);
_read needs a FILE * arg.
> > Word = 256*buffer[0]+buffer[1];
> > }
> >
just use ifstream:
WORD a;
char b;
file >> a >> b; // works fine!
or use fgetc:
WORD a;
a = 256 * fgetc(f) + fgetc(f)
> 2. Maybe bytes in BMPs Words aren't organized in that way:
> Word = 256*buffer[0]+buffer[1]
>
> but like that:
> Word = 256*buffer[1]+buffer[0]
pouzzler was right, BMPs are little-endian
>
> And sorry for my poor english :-)
what makes you think it's poor?
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |