⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getc.c

📁 异步通讯C语言例行子程序
💻 C
字号:
/* A module of ASYNCx.LIB version 1.20 */

#include "asyncdef.h"

/***************************************************************
 Get one byte from the input buffer of the async port
 associated with p. If a byte is found in the buffer, return
 its value in the form of an integer (without sign extension).
 If the buffer is empty, return a value of -1.
***************************************************************/
int a_getc(register ASYNC *p)
{byte c,*bp;
 if (p)
  {bp=p->ibuftail;        /* point to the next byte in the buffer */
   if (bp==p->ibufhead)   /* if there is nothing in the buffer,   */
     return -1;           /* return EOF.                          */
   c=(byte)(*bp++);       /* else, get the next byte.             */
   p->icount--;           /* adjust the byte count                */
   if (bp==p->ibufend)    /* wrap if necessary                    */
     bp=p->ibuf;
   p->ibuftail=bp;
   return (unsigned)c;    /* return the value retrieved           */
  }
 return -1;
} /* end of a_getc(p) */

⌨️ 快捷键说明

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