R – how can i represent a packet (binary stream) in a variable (c++)

binarypacket

hi i'm working on a personal project
for a transport parser.

i want to be able to represent a recived packet in binary number and afterwards be able to set specific bits.
I've got a pretty good idea how to do the second part but i'm really stuck at the beginning
ive got an advice to use unsigned char for that but can i really represent a full packet in that variable.

thanks

Best Solution

an unsigned char array is probably what you need: you can store whatever you want in this structure and access it in whatever means pleases you.

You could have this container in a bigger container too: the bigger container would have pointers to the each layer's beginning & end etc.

Related Question