#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
int main()
{
int f1,f2;int n=0;
char p[34];
int h=0;
f1=dup(0);//open(0,O_RDWR|O_CREAT|O_NONBLOCK,0666);
while(h<10)
{
n=read(f1, p+h, 34);
if(n==-1)
{
if(errno==EAGAIN)
{
continue;
}else
{
perror("error!");
break;
}
}else
{
h+=n;
}
}
printf("%d-%s\n",n,p);
close(f1);
return 0;
}
输入10个字符以上,再按回车