C++ – How to determine the length of an unsigned char*

c++charunsigned

How do you determine the length of an unsigned char*?

Best Solution

For the actual size of the pointer:

size_t s = sizeof(unsigned char*);

If you want the length of the string:

unsigned char* bla = (unsigned char*)"blabla";
int s = strlen((char*)bla);