I'm trying to use the function with the following declaration:
extern int stem(struct stemmer * z, char * b, int k)1
I'm trying to pass a C++ string to it, so I thought I'd use the c_str()
function. It returns const char *
. When I try to pass it to the stem()
function, I get this error: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
.
How can I store the result of c_str() such that I can use it with the stem
function?
Here is the code I'm running:
struct stemmer * z = create_stemmer();
char * b = s.c_str();
int res = stem(z, b, s.length()); //this doesn't work
free_stemmer(z);
return s.substr(0,res);