psld
July 11th, 2009, 06:51 PM
Hi!
I have a little problem.
The struct msgPacket contains a void* named packetStart. packetStart points at a place. I want the second byte that packetStart points at to be an adress to a char.
I've tried this:
msg.packetStart is void*, points at place, contains adress
msg.packetStart[1] is void, is sizeof(void) away from packetStart (yes I know I cant use sizeof(void)
(char)msg.packetStart[1] is char, 1 byte away from packetStart
&(char)msg.packetStart[1] is &char, should work? It dont.
The error is:
"pointer of type <void *> used in arithmetic"
The goal is to pass a &char over to strcpy();
I have a little problem.
The struct msgPacket contains a void* named packetStart. packetStart points at a place. I want the second byte that packetStart points at to be an adress to a char.
I've tried this:
msg.packetStart is void*, points at place, contains adress
msg.packetStart[1] is void, is sizeof(void) away from packetStart (yes I know I cant use sizeof(void)
(char)msg.packetStart[1] is char, 1 byte away from packetStart
&(char)msg.packetStart[1] is &char, should work? It dont.
The error is:
"pointer of type <void *> used in arithmetic"
The goal is to pass a &char over to strcpy();