Creating and getting information about processes. - Poco
Creating and getting information about processes. - Poco
Creating and getting information about processes. - Poco
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
#include "<strong>Poco</strong>/Process.h"#include "<strong>Poco</strong>/PipeStream.h"#include "<strong>Poco</strong>/StreamCopier.h"#include using <strong>Poco</strong>::Process;using <strong>Poco</strong>::ProcessH<strong>and</strong>le;int main(int argc, char** argv){std::string cmd("/bin/ps");std::vector args;args.push_back("-ax");<strong>Poco</strong>::Pipe outPipe;ProcessH<strong>and</strong>le ph = Process::launch(cmd, args, 0, &outPipe, 0);<strong>Poco</strong>::PipeInputStream istr(outPipe);std::ofstream ostr("<strong>processes</strong>.txt");<strong>Poco</strong>::StreamCopier::copyStream(istr, ostr);}return 0;