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


Question

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

1
20
5/8/2009 12:26:15 PM

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);
29
5/8/2009 12:25:14 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon