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

ads picture ads · May 7, 2009 · Viewed 80.6k times · Source

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

Answer

joce picture joce · May 7, 2009

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);