我有一个使用fork并执行命令的代码,命令是date 这段代码有效 我想知道怎么用命令ls |来做更
case 0 :
*// Send the command from child proccess*
dup2(pipefd[1], fileno(stdout));
close (pipefd[0]);
execl ("/bin/date","date",0,NULL);
default:
dup2(pipefd[0], fileno(stdin));
close (pipefd[1]);
**// HERE ,,, im wonder hot to get more result**
cin.getline(str, 1023);
cout << "The date is " << str << endl;
died= wait(&status);