How to convert a 4-byte “string” to an uint32_t?
问题 Basically, I have a byte-string of data like: \x00\x00\x00\x00 \x08\x00\x00\x00 \x05\x00\x00\x00 (spaces are used only for visibility, there are no space bytes in the actual byte-string). The data is little-endian. Now, I need to extract the second 4-byte group ( \x08\x00\x00\x00 , which is 128 ) and turn them it an unsigned long. So, uint32_t type. Basically, what I'm doing is: moveBlock(&gdata->str[4], &second_group, 4); Where moveBlock is a macro: #define moveBlock(src,dest,size) memmove