SRL Archive - C/C++ Help and Tutorials

How I can open other shell with C++?


Repentinus

2008-04-15 12:35:05

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

2008-04-15 17:46:17

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

2008-04-16 13:28:00

One more question: on UNIX shell you open program like on Windows? Just write its name?