Click here to Skip to main content
15,914,444 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: using scanner in programe Pin
BlackDice17-Jun-05 4:47
BlackDice17-Jun-05 4:47 
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 
I have the following structures and unions defined and I have created a DataHolderUnion object using new.

struct Filler
{
unsigned int f : 16 ;
} ;

struct DataHolder
{
Filler filler1 [42] ;
Filler filler2 [192] ;
Filler filler3 [192] ;
Filler filler4 [384] ;
} ;

typedef union
{
struct DataHolder data_holder ;
} DataHolderUnion ;


What I then have is an array of unsigned chars whose size matches the total size of DataHolder, so I then do:

DataHolderUnionPtr = (DataHolderUnion*) myUCharArr ;

however the data then contained in DataHolderUnionPtr is not what I expect. I have located the problem (*I think*) to the DataHolder structure and in particular to the arrays used (I found this by changing "Filler filler1 [42] ;" to 42 variables declared as:

unsigned int f1 : 16 ;
....
unsigned int f42 : 16 ;

when I did this all of the data I expected to see in each of the 'f' variables was there and correct.

So after this long winded explanation can anyone tell me if its possible to continue using an array (or similar method) in my struct or of anyways around this problem?

many thanks,
GeneralRe: unions and structs Pin
Bob Stanneveld17-Jun-05 3:49
Bob Stanneveld17-Jun-05 3:49 
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 

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.