Solved

Reding bmp header return 65536 as width ??

Posted on 2010-09-05
1
319 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Determining the an SCCM package name from the Package ID
An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

729 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