Mail Archives: djgpp/1998/06/08/12:30:15
Newsgroups: | comp.os.msdos.djgpp
|
From: | vnlad AT myna DOT com (Vimal N. Lad / Gautam N. Lad)
|
Subject: | Sizeof messed up
|
Date: | Mon, 08 Jun 1998 16:29:08 GMT
|
NNTP-Posting-Host: | dh-48.tor0421.myna.com
|
Message-ID: | <357c0fc1.0@news.myna.com>
|
Lines: | 24
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hi,
I have DJGPP v2.7.2 (I think) and Allegro v3.0. I am trying to make
my own TGA reader (I know Allegro already has it, but this is for
a Windows program and I am using DJGPP & Allegro to test
and display the format).
For some odd reason, the sizeof function returns the wrong size.
I have a structure, which is exactly 18 bytes long. When I call
sizeof(TGAHEAD); (I am trying to read the header of a .TGA file),
it says the header is 20 bytes long. I have the correct structure
for the TGA format and in another compiler, Turbo C++ v1.0, it
returns the correct size wich is 18 bytes.
What's going on? I can't seem to figure it out! Maybe it;s my code?
The structure only uses two types: WORD (unsigned short) which is 2 bytes and
BYTE (unsigned byte) which is one byte.
Help!
Bye!
Gautam N. Lad / Vimal N. Lad
- E-mail: vnlad AT myna DOT com
- Website: http://www.geocities.com/SiliconValley/Heights/1107
- Raw text -