let say I have a char pointer like this:
unsigned char* value="Hello\0Hello";
how can i calculate the size of value, as strlen only calculate the size of string until the '/0' so I can not use strlen, and also sizeof returns the length of the pointer itself so is there any way to calculate the length of the value?
There is no built-in function for this scenario.
The only possibility to calculate the string length is if either:
the string is double null-terminated, eg:
Hello\0Hello\0\0if you know in advance how many intermediate null characters exist in the string before the final null terminator.
In either case, you can then enumerate the string, counting the chars and skipping the intermediate nulls, until you reach the final null terminator.
If neither of those cases is true in your situation, then you are out of luck unless you have an out-of-band way to know the string's length.