[Solved] system() function in g++


Your line

system("cd /usr/home/game2/channel" + i + atoi("/core") + c + atoi("/ && rm -R syslog && rm -R syserr"));

should be like this

const auto path = "/usr/home/game2/channel" + std::to_string(i) + "/core" + std::to_string(c);
const auto cmd1 = "rm -R " + path + "/syslog";
const auto cmd2 = "rm -R " + path + "/syserr";

system(cmd1.c_str());
system(cmd2.c_str());

c++11 is needed to compile this and I did not test the code. I suggest not to use system, but unlink and rmdir or a c++ library that offers classes and functions for removing folders recursively.

solved system() function in g++