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;
}
Printable View
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;
}
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.Quote:
Originally Posted by winsonlee
make sure you have "using namespace std;" or do this to declare the string:
std::string x;