I am new to c and just learning, I am trying to find a way of reading a hex value from a string and store in a byte array but I am getting a stack around variable failure.
char hexstring[] = "78E2401A417231D2", *position = hexstring;
BYTE hex[8];
size_t count = 0;
for (count = 0; count < sizeof(hex) / sizeof(hex[0]); count++) {
sscanf(position , "%2hhx", &hex[count]);
position += 2;
}
Error
Run-Time Check Failure #2 - Stack around the variable 'hex' was corrupted.