www.pudn.com > ASYNC13.rar > PRINTF.C


/* A module of ASYNCx.LIB version 1.02 */ 
 
#include  
#include  
#include "asyncdef.h" 
 
/********************************************************************* 
 Format the variable argument list according to the format string and 
 send the resulting text to port p. Return the number of characters 
 sent to the port, or -1 if there is an error. 
*********************************************************************/ 
int a_printf(register ASYNC *p,char *format,...) 
{register char s[1024]; /* a large string */ 
 int i; 
 va_list ap; 
 if (p) 
  {va_start(ap,format); 
   vsprintf(s,format,ap); 
   for(i=0;i<1024 && s[i];i++) 
     a_putc((unsigned char)s[i],p); 
   return i; 
  } 
 return -1; 
} /* end of a_printf(p,format,...) */