I'm relatively new to C so I appreciate your assistance for my novice question.
I have a struct pointing to some data. Let's say...
typedef struct
{
unsigned char var1[6];
unsigned char var2[6];
} MY_STRUCT;
Now, I'm pointing this struct at some hexadecimal data.
MY_STRUCT *tmpStruct;
tmpStruct = (MY_STRUCT*)ptrWherever;
My question is, how can I reference the items in this structure and print the hexadecimal results? I've done the following:
printf("%06x \n", tmpStruct->var1);
What I would LIKE to see would be something like:
00062977B1AD (6 pairs in a MAC address)
Instead, I'm getting:
A02798
Am I translating it incorrectly? Thanks in advance,
RJ
************
RudeJohn
************
I have a struct pointing to some data. Let's say...
typedef struct
{
unsigned char var1[6];
unsigned char var2[6];
} MY_STRUCT;
Now, I'm pointing this struct at some hexadecimal data.
MY_STRUCT *tmpStruct;
tmpStruct = (MY_STRUCT*)ptrWherever;
My question is, how can I reference the items in this structure and print the hexadecimal results? I've done the following:
printf("%06x \n", tmpStruct->var1);
What I would LIKE to see would be something like:
00062977B1AD (6 pairs in a MAC address)
Instead, I'm getting:
A02798
Am I translating it incorrectly? Thanks in advance,
RJ
************
RudeJohn
************