练习题目:编写一个程序,程序中创建一个子进程,然后父子进程各自独立运行。父进程不断在标准输入设备上读入小写字母,写入管道。子进程不断地从管道中读取字符,转换为大写字母后再输出到标准输出设备上。当读到‘x’时,程序结束。
建议使用的系统调用或函数:fork();pipe();write();read().
笔者运行的条件是在ubuntu系统之上,需要注意的是要先创建管道(pipe()),再使用fork()创建子进程,不然将得不到想要的效果。
#include<stdio.h>
#include<iostream>
#include<unistd.h>
#include<string.h>
using namespace std;
int main(int argc,char *argv[])
{
int p1,p[2]