Code:#include <string> void Calc::yyerror(const char * mesg) { string x; // how can i make this to work ??? I would like to copy the mesg to the x string. x = mesg; }
Code:#include <string> void Calc::yyerror(const char * mesg) { string x; // how can i make this to work ??? I would like to copy the mesg to the x string. x = mesg; }
How can you make it work? It should work exactly as you have it written in your example above. One of the assignment operators for the string class takes a constant pointer to character as an argument.Originally Posted by winsonlee
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
make sure you have "using namespace std;" or do this to declare the string:
std::string x;
source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense