Novic C programmer needs help

d^2 pyr201 at psc90.UUCP
Sun Feb 11 14:34:30 AEST 1990


Below is a piece of code used in the recently posted Tetris game.
On our system, (BSD), this produces crap.  Namely the last text
output is kept forever in some buffer somewhere and it shows up
in the integer output, ie, 15Press any key.

I made some hacks to it, but I need to know what the library function
_doprnt does or better yet what this function form() does.

Can anyone answer this question for me?  Thanks in advance.

char *form (va_alist)
  va_dcl
{
  va_list pvar;
  char *fmt_string;
  static char result[LINELEN];
  FILE b;
  
  va_start (pvar);
  fmt_string = va_arg (pvar, char*);

  b._flag = _IOWRT|_IOSTRG;
  b._ptr = result;
  b._cnt = LINELEN;

--->  _doprnt(fmt_string, pvar, &b); <---

  putc('\0', &b);

  va_end (pvar);
  return (result);
}



More information about the Comp.lang.c mailing list