eof.c

来自「异步通讯C语言例行子程序」· C语言 代码 · 共 23 行

C
23
字号
/* A module of ASYNCx.LIB version 1.02 */

#include <dos.h>
#include "asyncdef.h"

/************************************************************
 Wait for at least t eighteenths of a second for a character
 to arrive at port p. If no character arrives, return 1.
 Otherwise return 0. Also if p is NULL return 1 so that
 unopened ports seem to be in an eof state.
************************************************************/
int a_eof(register ASYNC *p,int t)
{unsigned long t0,far *t1;
 if (p)
  {t1=(unsigned long far *)MK_FP(0x40,0x6c);
   t0=*t1;
   while(p->ibufhead==p->ibuftail && (*t1)-t0<=(unsigned long)t);
   if (p->ibuftail!=p->ibuftail)
     return 0;
  }
 return 1;
} /* end of a_eof(p) */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?