|

楼主 |
发表于 2007-7-4 14:35:54
|
显示全部楼层
我Ù个程序书上的例子,用getmsg把标Æ入复制到标Æú。- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <errno.h>
- #include <stropts.h>
- #define BUFFSIZE 4096
- int main(void)
- {
- int n,flag;
- char ctlbuf[BUFFSIZE],datbuf[BUFFSIZE];
- struct strbuf ctl,dat;
- ctl.buf=ctlbuf;
- ctl.maxlen=BUFFSIZE;
- dat.buf=datbuf;
- dat.maxlen=BUFFSIZE;
- for(;;)
- {
- flag=0;
- if((n=getmsg(STDIN_FILENO,&ctl,&dat,&flag))<0)
- {
- printf("getmsg error: %s.\n",strerror(errno));
- }
- fprintf(stderr,"flag=%d, ctl.len=%d, dat.len = %d\n",flag,ctl.len,dat.len);
- if(dat.len==0)exit(0);
- else if(dat.len>0)
- if(write(STDOUT_FILENO,dat.buf,dat.len)!=dat.len)
- printf("write error\n");
- }
- }
复制代码 Ð行的Ó是
getmsg error: Function not implemented.
flag=0, ctl.len=0, dat.len = 0 |
|