i need convert char array of c string c++ char array element of struct.
code:
this structure in c
typedef struct mystruct { char name[50]; char abc[50]; esl_bool status; }mystruct; and want access name[50] in c++ have convert string. have tried strcpy , memcpy. using esl_bool status; , working confused name[50].
the first thing should change in class name in struct because cause problems because keyword in c++.
then converting c string c++ one, can use std::string constructor accepts c-style strings.
std::string mycppstring(mystruct.name);
Comments
Post a Comment