I have a const char*
pointing to data in hex format, I need to find the length of the data for that I am checking for NUL
-terminator but when \x00
comes up it detects it as NUL
-terminator returning incorrect length.
How can I get around that?
const char* orig = "\x09\x00\x04\x00\x02\x00\x10\x00\x42\x00\x02\x00\x01\x80\x0f\x00"
uint64_t get_char_ptr_len(const char *c)
{
uint64_t len = 0;
if (*c)
{
while (c[len] != '\0') {
len++;
}
}
return len;
}