If num1
and num2
are const char *
, you can use std::string
.
std::string cmd_line = std::string() +
"gnome-terminal -x sh -c 'cd; cd project/into_bot/; "
"sh ./matlab_batcher.sh localize \"" +num1+","+num2+"\"; "
"exec bash;";
system( cmd_line.c_str() );
Semantically what's happening here is you create a temporary variable with std::string()
which is used to build the string, then after everything is built it's used to initialize the permanent variable cmd_line
.