| 1 |
ab11 |
1.1 |
// tpopen.cc. Test for -*- C++ -*- socket library |
| 2 |
|
|
// Copyright (C) 1992,1993,1994 Gnanasekaran Swaminathan <gs4t@virginia.edu> |
| 3 |
|
|
// |
| 4 |
|
|
// Permission is granted to use at your own risk and distribute this software |
| 5 |
|
|
// in source and binary forms provided the above copyright |
| 6 |
|
|
// notice and this paragraph are preserved on all copies. |
| 7 |
|
|
// This software is provided "as is" with no express or implied warranty. |
| 8 |
|
|
// |
| 9 |
|
|
// Version: 17Oct95 1.10 |
| 10 |
|
|
|
| 11 |
|
|
#include <pipestream.h> |
| 12 |
|
|
#include <unistd.h> |
| 13 |
|
|
|
| 14 |
|
|
int main() |
| 15 |
|
|
{ |
| 16 |
|
|
char buf[128]; |
| 17 |
|
|
|
| 18 |
|
|
ipipestream ipopen("tpopentest -o"); |
| 19 |
|
|
cout << "Got from ipopen: "; |
| 20 |
|
|
while(ipopen >> buf) |
| 21 |
|
|
cout << buf << ' '; |
| 22 |
|
|
cout << endl; |
| 23 |
|
|
|
| 24 |
|
|
opipestream opopen("tpopentest -i"); |
| 25 |
|
|
opopen << "this is sent to tpopentest" << endl; |
| 26 |
|
|
|
| 27 |
|
|
iopipestream iopopen("tpopentest -b"); |
| 28 |
|
|
iopopen << "echo test one two three" << endl; |
| 29 |
|
|
cout << "Result from iopopen: "; |
| 30 |
|
|
while (iopopen >> buf) cout << buf << ' '; |
| 31 |
|
|
cout << endl; |
| 32 |
|
|
|
| 33 |
|
|
return 0; |
| 34 |
|
|
} |