home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / ansi / stdio / fprintf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-26  |  585 b   |  27 lines

  1. /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
  2. #include <stdio.h>
  3. #include <libc/file.h>
  4.  
  5. int
  6. fprintf(register FILE *iop, const char *fmt, ...)
  7. {
  8.   int len;
  9.   char localbuf[BUFSIZ];
  10.  
  11.   if (iop->_flag & _IONBF)
  12.   {
  13.     iop->_flag &= ~_IONBF;
  14.     iop->_ptr = iop->_base = localbuf;
  15.     iop->_bufsiz = BUFSIZ;
  16.     len = _doprnt(fmt, (&fmt)+1, iop);
  17.     fflush(iop);
  18.     iop->_flag |= _IONBF;
  19.     iop->_base = NULL;
  20.     iop->_bufsiz = NULL;
  21.     iop->_cnt = 0;
  22.   }
  23.   else
  24.     len = _doprnt(fmt, (&fmt)+1, iop);
  25.   return ferror(iop) ? EOF : len;
  26. }
  27.