406  11.     

//  11.20.    
//                 attach()

infc Fd[2] ;

ofstream OPipe;

//. . .
pipe(Fd) ;

//. . .

OPipe.attach(Fd[l]) ;

//. . .
OPipe  Value  endl;

   -  
  ,      .
  11.1      fork-. -
        iostreams-
 .

//  11.1

1 ttinclude <unistd.h>

2 ftinclude <iostream.h>

3 ^include <fstream.h>

4 ft include <math.h>

5 ^include <sys/wait.h>

6

7

8

9

10 int main(int argc, char *argv[])

11 {

12

13  int Fd[2] ;

14  int Pid;

15  float Value;

16  int Status;

17  if(pipe(Fd) != 0){

18     cerr  "    "  endl;

19     exit(l);

20  }

21  Pid = fork() ,-

22  if(Pid == 0){

23     ifstream IPipe<Fd[0]);

24     IPipe  Value;

25     cout  " -  
 Value  endl;

26     IPipe.close();

27  }

28  else{

29     ofstream OPipe(Fd[l]);

30     OPipe  M_PI  endl;

31     waitf&Status) ;

32     OPipe.close() ;

33

34  }

35

36 }