Click here to Skip to main content
15,922,015 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: using scanner in programe Pin
Ravi Bhavnani17-Jun-05 4:48
professionalRavi Bhavnani17-Jun-05 4:48 
Generalunicode and ansi Pin
Anonymous17-Jun-05 3:47
Anonymous17-Jun-05 3:47 
GeneralRe: unicode and ansi Pin
Bob Stanneveld17-Jun-05 3:52
Bob Stanneveld17-Jun-05 3:52 
GeneralRe: unicode and ansi Pin
Jack Puppy17-Jun-05 4:28
Jack Puppy17-Jun-05 4:28 
GeneralRe: unicode and ansi Pin
Anonymous17-Jun-05 4:38
Anonymous17-Jun-05 4:38 
GeneralRe: unicode and ansi Pin
Anonymous17-Jun-05 4:52
Anonymous17-Jun-05 4:52 
Generalunions and structs Pin
mcsherry17-Jun-05 3:01
mcsherry17-Jun-05 3:01 
GeneralRe: unions and structs Pin
Bob Stanneveld17-Jun-05 3:49
Bob Stanneveld17-Jun-05 3:49 
Hello,

I think that you have a problem with the bitfields and alignment. Your struct is aligned at 32bit (if I'm correct) and you have 16 bit sized structures. So what happens with your array is the following: you have a struct with a member of 2 bytes and a size of 4 (the alignment). So your struct is 4 bytes. Your array consist of Filler objects, which are 4 bytes. You want them to be 2 bytes, not?

Assuming that, you can one of the following things: turn off the alignment, or don't use bitfields, but just a short or a WORD instead of your struct:
// turn of alignment
#pragma pack(push, 1) // store old alignment and set new alignment of 1 byte
// your struct here
#pragma pack(pop) // restore aligmnent.


// A far better solution is to have an array of 2 byte sized values:
struct DataHolder
{
WORD filler1 [42] ;
WORD filler2 [192] ;
unsigned __int16 filler3 [192] ; // same as a WORD
unsigned short filler4 [384] ; // same as a WORD
};


Hope this helps Smile | :)


Behind every great black man...
            ... is the police. - Conspiracy brother


Blog[^]
GeneralRe: unions and structs Pin
mcsherry21-Jun-05 22:04
mcsherry21-Jun-05 22:04 
GeneralRe: unions and structs Pin
Bob Stanneveld21-Jun-05 22:07
Bob Stanneveld21-Jun-05 22:07 
GeneralRe: unions and structs Pin
krmed17-Jun-05 3:51
krmed17-Jun-05 3:51 
GeneralRe: unions and structs Pin
mcsherry21-Jun-05 22:05
mcsherry21-Jun-05 22:05 
QuestionHow to respond VK_LEFT and VK_DOWN at the same time? Pin
simon wan17-Jun-05 2:39
simon wan17-Jun-05 2:39 
AnswerRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
BlackDice17-Jun-05 2:54
BlackDice17-Jun-05 2:54 
GeneralRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
simon wan17-Jun-05 14:44
simon wan17-Jun-05 14:44 
AnswerRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
David Crow17-Jun-05 3:31
David Crow17-Jun-05 3:31 
GeneralRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
BlackDice17-Jun-05 4:54
BlackDice17-Jun-05 4:54 
GeneralRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
David Crow17-Jun-05 5:14
David Crow17-Jun-05 5:14 
GeneralRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
BlackDice17-Jun-05 5:20
BlackDice17-Jun-05 5:20 
GeneralRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
David Crow17-Jun-05 5:24
David Crow17-Jun-05 5:24 
GeneralRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
BlackDice17-Jun-05 5:32
BlackDice17-Jun-05 5:32 
GeneralRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
Toby Opferman23-Jun-05 10:44
Toby Opferman23-Jun-05 10:44 
AnswerRe: How to respond VK_LEFT and VK_DOWN at the same time? Pin
Bob Stanneveld17-Jun-05 3:38
Bob Stanneveld17-Jun-05 3:38 
GeneralMapping a network drive programmatically Pin
Still learning how to code17-Jun-05 2:15
Still learning how to code17-Jun-05 2:15 
GeneralRe: Mapping a network drive programmatically Pin
David Crow17-Jun-05 2:22
David Crow17-Jun-05 2:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.