认真看书,另外在你了解终端前不要对STDIN_FILENO和STDOUT_FILENO进行操作。你可以玩常规文件。
Data is read from an open file with the read function.
#include <unistd.h>
ssize_t read(int filedes, void *buf, size_t nbytes);
Returns: number of bytes read, 0 if end of file, 1 on error
If the read is successful, the number of bytes read is returned. If the end of file is encountered, 0 is returned.
----------------解决方案--------------------------------------------------------