我们什么时候应该使用fdopen,我们如何使用fdopen?我对此的理解是,我们不能用fopen来阅读(从管道中读取)。我不太明白手册页上对fdopen的描述:The fdopen() function associates a stream with the existing file descriptor, fd。
我在调用fdopen时收到一个错误,它将errno设置为22。我正在使用exec命令调用子进程。子进程对文件描述符4调用fdopen。第一个子进程工作并将数据发送回父进程,errno为0。父进程创建下一个子进程后,将在errno设置为22时再次调用fdopen(4, "w");。 int id = atoi(argv[argc-1]);
//Child kid