std::string convert to const char *
inline char * getCharPtr(string &str){
char *cha = new char[str->size() + 1];
memcpy(cha,str->c_str(),str->size() + 1);
const char *p = cha; //point to this new allocated memory
return p;
}