PDA

View Full Version : How I can open other shell with C++?



Repentinus
04-15-2008, 04:35 PM
Hi. I need to open other shell/window with C++. It should work cross-platform and function should accept string variables and constants as params. This is why I can't use system().

Yakman
04-15-2008, 09:46 PM
system() does work, you probably didn't join the strings up properly

try this


#include <string>

string line = "ping " + someparam + " " + moreparams";
system(line.c_str());


that hopefully works, i just wrote it in the reply window though

Repentinus
04-16-2008, 05:28 PM
One more question: on UNIX shell you open program like on Windows? Just write its name?