home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 400_01 / socketpp-1.5 / test / tpipe.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-06  |  865 b   |  47 lines

  1. // tpipe.cc. Test for -*- C++ -*- socket library
  2. // Copyright (C) 1992,1993 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: 07Nov93 1.5
  10.  
  11. #include <pipestream.h>
  12.  
  13.  
  14. main(int ac, char** av)
  15. {
  16.     iopipestream p;
  17.  
  18.     if ( p.fork() ) {
  19.         // I am the parent
  20.         cout << "parent got: ";
  21.         while (ac--) {
  22.             char buf[32]="";
  23.             
  24.             p << ac << endl;
  25.             p >> buf;
  26.             cout << buf << ' ';
  27.         }
  28.         cout << endl;
  29.         return 0;
  30.     } else {
  31.         // I am the child
  32.         int i;
  33.         cout << "child got: ";         
  34.         while (p >> i) {
  35.             p << av[i] << endl;
  36.             cout << i << ' ';
  37.  
  38.         }
  39.         cout << endl;
  40.         return 0;
  41.     }
  42. }
  43.  
  44.     
  45.         
  46.             
  47.