I am little poor in type casting. I have a string in xmlChar*
(which is unsigned char*), I want to convert this unsigned char to a std::string
type.
xmlChar* name = "Some data";
I tried my best to type cast , but I couldn't a way to convert it.
reinterpret_cast<char*>(name)
casts fromunsigned char*
tochar*
in an unsafe way but that's the one which should be used here. Then you call the ordinary constructor ofstd::string
.You could also do it C-style (not recommended):