union CommandBlockWrapper
{
struct HostCBW CBWField;
BYTE CBWBuffer[31];
}CBW;
How can I modify this union, to have the CBW.CBWField.CBWCB[0] to be at the same address as an additional byte variable?
In other words that I will be able to call this particular byte using a different name. _________________ Alex
Charlie U
Joined: 09 Sep 2003 Posts: 183 Location: Somewhere under water in the Great Lakes
Posted: Wed Feb 09, 2005 7:38 am
The structure and the array in the union are just overlapped. You can access the first byte of the union by using either
CBW.CBWBuffer[0]
or
CBW.CBWField.Signature[0].
The other bytes are just accessed similarly in the order that you have declared them.
alexz
Joined: 17 Sep 2004 Posts: 133 Location: UK
Posted: Wed Feb 09, 2005 7:42 am
Charlie U wrote:
The structure and the array in the union are just overlapped. You can access the first byte of the union by using either
CBW.CBWBuffer[0]
or
CBW.CBWField.Signature[0].
The other bytes are just accessed similarly in the order that you have declared them.
Yeah, I know that.
What I mean is, you can use those two different names because thay are at the same address.
I want #define newname CBW.CBWField.Signature[0]
but the same way as in unions. to have another variable at the same address _________________ Alex
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum