puts.c

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

C
30
字号
/* A module of ASYNCx.LIB version 1.20 */

#include "asyncdef.h"

/*
** Send the null-terminated string of characters pointed to by s to the
** port associated with p. If port p is not open, return -1. Otherwise,
** return the number of characters that were sucessfully transmitted.
** (If XON/XOFF is turned on and an XOFF character is received during
** the transmission of the string, a_puts will return the number of
** character that were successfully placed into the output buffer so
** that the calling application will be able to pick up where it was cut
** off.) This function does NOT append a '\n' or '\r' character to the
** string.
*/
int a_puts(register char *s,register ASYNC *p)
{unsigned count;
 if (p)
  {count=0;
   while(*s)
     if (a_putc(*s,p)==*s)
      {s++;
       count++;
      }
   return(count);
  }
 else
   return -1;
} /* end of a_puts(s,p) */

⌨️ 快捷键说明

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