Skip to content

Commit 7c0baaf

Browse files
committed
Small sample.
1 parent 95c0af3 commit 7c0baaf

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

sample.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <process.h>
2+
3+
#include <iostream>
4+
5+
int main()
6+
{
7+
procxx::process ping( "ping", "www.google.com", "-c", "2" );
8+
ping.exec();
9+
10+
std::string line;
11+
while( std::getline( ping.output(), line ) )
12+
{
13+
std::cout << line << std::endl;
14+
if( !ping.running() || !procxx::running(ping.id()) || !running(ping) )
15+
{
16+
std::cout << "not running any more" << std::endl;
17+
break;
18+
}
19+
}
20+
21+
ping.wait();
22+
std::cout << "exit code: " << ping.code() << std::endl;
23+
24+
return 0;
25+
}
26+

0 commit comments

Comments
 (0)