I'm tring to parse a UUID string to an std::array via sscanf, but something is wrong and I can'T seam to idetify the problem:
std::array<uint8_t, 16> arr{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
sscanf("00112233-4455-6677-8899-AABBCCDDEEFF",
"%hhx%hhx%hhx%hhx-%hhx%hhx-%hhx%hhx-%hhx%hhx-%hhx%hhx%hhx%hhx%hhx%hhx",
&arr[0], &arr[1], &arr[2], &arr[3], &arr[4], &arr[5], &arr[6], &arr[7],
&arr[8], &arr[9], &arr[10], &arr[11], &arr[12], &arr[13], &arr[14], &arr[15]
);
The array contains 0x33,0xab,0x89,0x67,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
afterwards. Any idea what's wrong?
Aucun commentaire:
Enregistrer un commentaire