| 1 |
#include "parentslurp.h" |
| 2 |
|
| 3 |
#include <string> |
| 4 |
#include <iostream> |
| 5 |
|
| 6 |
//PARENT |
| 7 |
void ParentSlurp::parentProcess() |
| 8 |
{ |
| 9 |
std::string line; |
| 10 |
size_t nr = 1; |
| 11 |
|
| 12 |
while (getline(std::cin, line)) |
| 13 |
std::cout << nr++ << ": " << line << '\n'; |
| 14 |
|
| 15 |
waitForChild(); |
| 16 |
} |
| 17 |
//= |
| 18 |
//MAIN |
| 19 |
int main() |
| 20 |
{ |
| 21 |
ParentSlurp{}.fork(); |
| 22 |
} |
| 23 |
/* |
| 24 |
Generated Output (example only, actually obtained output may differ): |
| 25 |
|
| 26 |
1: a.out |
| 27 |
2: bitand.h |
| 28 |
3: bitfunctional |
| 29 |
4: bitnot.h |
| 30 |
5: daemon.cc |
| 31 |
6: fdinseek.cc |
| 32 |
7: fdinseek.h |
| 33 |
... |
| 34 |
*/ |
| 35 |
//= |