[Solved] invalid conversion from ‘const char*’ to ‘char* [closed]


Well that’s because c_str() returns a const char * and not a char *

Just change the line to:

const char * c = s.c_str();

and the function declaration to

std::string Exec(const char* cmd)

Like noted before and you’re good to go.
See it live here.

solved invalid conversion from ‘const char*’ to ‘char* [closed]