Solved

Reding bmp header return 65536 as width ??

Posted on 2010-09-05
1
310 Views
Last Modified: 2013-12-04
Hello, I am trying to read a bmp header this way:

typedef struct _SBMP3256
{
	BITMAPFILEHEADER bmfHeader;
	BITMAPINFOHEADER bmiHeader;
	RGBQUAD colors[256];
}BMP3256,*PBMP3256;

Open in new window


but this is what I get:

{biSize=9830400 biWidth=9830400 biHeight=65536 biPlanes = 32 ...

And the same code works in another program.
0
Comment
Question by:Greg2FS
1 Comment
 

Accepted Solution

by:
Greg2FS earned 0 total points
ID: 33605989
I found the solution, it is a compiler issue, it seems than the structure members alignement was not the same putting to 1 solve the problem.

Can do like that:
[code]#pragma pack(push, 1)

//structure(s)

#pragma pack(pop)[/code]
#pragma pack(push, 1)

//structure(s)

#pragma pack(pop)

Open in new window

0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question