16 const int FMode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
17
18 int main(int argc, char *argv[])
19 {
20
21 int Pid,Status,Size;
22 double Value;
25 mkfifo("/tmp/channel.l»,FMode) ;
26 mkfifo (" / tmp/channel. 2», FMode) ;
28 vector<double> X(100,13.0);
29 vector<double> Y;
30 ofstream OPipe("/tmp/channel.l»,ios::app);
31 ifstream IPipe("/tmp/channel.2»);
32 OPipe << X.size() « endl;
33 ostream_iterator<double> Optr(OPipe,"\n»);
34 copy(X.begin(),X.end(),Optr);
35 OPipe « flush;
36 IPipe » Size;
37 for (int N = 0;N < Size; N++)
38 {
39 IPipe » Value;
40 Y.push_back(Value);
41 }
42
43 IPipe.close();
44 OPipe.close();
45 unlink("/tmp/channel.1»);
46 unlink("/tmp/channel.2»);
47 cout « accumulate(Y.begin(),Y.end(),-13.0) « endl;
48