I have a buffer like char array like this:
char buf[4];
buf[0] = 0x82;
buf[1] = 0x7e;
buf[2] = 0x01;
buf[3] = 0x00;
I would now like to read char two and three together as a 16Bit unsigned integer in big endian. How do I do this with C(++) standard tools?
Currently I would only know the manual solution:
int length = but[3];
length += but[2] << 8;
This would be easy for 16Bit integers but I need also to parse 32Bit integers which would make things a bit difficult. So is there a function from the standard lib which does this for me?
Bodo