Overview
Features
Download
Documentation
Community
Add-Ons & Services

Command interpreter (ala win32 system('cmd'))?

A general discussion forum.

Command interpreter (ala win32 system('cmd'))?

Postby hardingdgh » 20 Sep 2010, 18:38

Hi,

I was wondering if Poco provides a way to send a command to the system command intepreter like Win32 system() does? Now if you must know I simply want to be able to call "cls" or "clear" depending upon whether we're running on Win32 or Linux. My problem is that there is no portable console library (ala ncurses) which would allow me to manipulate the console. The funny thing is I just want to clear the screen and I might just issue a bunch of printf(\n) but apparently that was in this code previoulsy and for some reason the customer didn't like it.

Thanks
hardingdgh
 
Posts: 4
Joined: 25 Aug 2010, 18:30
Location: St. Louis, MO USA

Re: Command interpreter (ala win32 system('cmd'))?

Postby guenter » 20 Sep 2010, 19:02

Code: Select all
#include "Poco/Process.h"
...
Poco::Process::Args args;
#ifdef _WIN32
args.push_back("/c");
args.push_back("cls");
Poco::ProcessHandle ph(Poco::Process::launch("cmd.exe", args));
#else
Poco::ProcessHandle ph(Poco::Process::launch("clear", args));
#endif
ph.wait();
guenter
 
Posts: 1165
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests