I am receiving a stream of const char* msg types of a certain size_t len. At some byte offset within there there is a sequence number (32 or 64 byte, im not sure which) so my idea was to do the following every time I get one of the msg things:
for (int i = 0; i < 30; ++i)
{
uint32_t seq = *(uint32_t*) msg[i];
cout << "seq" << i << " " << seq << endl;
}
//and similar for 64 bytes
so that afterwards I can group the lines with the same offset and see which offset i is giving me sequential looking output. The problem with this is that I segfault with stuff like:
(gdb) p *(uint32_t*) msg[i]
Cannot access memory at address 0x2d
How can I carry out my little search idea for the sequence numbers?
Try:
and
EDIT: A bigger change, which is potentially more portable is: