I want to convert a std::string into a char* or char[] data type.

std::string str = "string";
char* chr = str;

Results in: “error: cannot convert ‘std::string’ to ‘char’ …”.

What methods are there available to do this?

18 Answers
18

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *