C++ string to char conversion -
i have function requires parameter of type 'unsigned char'.
if use:
unsigned char x[8] = "a\0ab-cd";
and pass 'x' parameter function call, desired result.
however, inputs rwcstrings, , not char type variable.
in case, have :
rwcstring a1 = "a"; rwcstring b1 = "ab-cd";
i try concatenate using :
rwcstring final = a1 + "\0" + b1;
and try using conversion inside function call (unsigned char*) final.data();
however, produces different result called function.
what doing wrong here ?
when doing a1 + "\0" operation, sourcepro evaluates "\0" string length = 0, returning a1.
the documentation += operator notes operator doesn't support strings embedded nulls.
Comments
Post a Comment