home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / XGRP_000.SZH / LOG.C < prev    next >
C/C++ Source or Header  |  1991-08-21  |  661b  |  32 lines

  1. #include "xgroup.h"
  2.  
  3.  
  4. extern int logfilehandle;
  5.  
  6. void _cdecl logf (char *szFormat, ...) {
  7.  
  8.   #define MAX_BUFFER_LENGTH 512
  9.  
  10.     static char  chBuffer[MAX_BUFFER_LENGTH];
  11.     char         ldate[24];
  12.     unsigned int sLength;
  13.     va_list      pArguments;
  14.  
  15.  
  16.     if(logfilehandle == -1) return;
  17.  
  18.     va_start(pArguments,szFormat);
  19.     sLength = vsprintf(chBuffer,szFormat,pArguments);
  20.     va_end(pArguments);
  21.  
  22.     _strdate(ldate);
  23.     ldate[8] = ' ';
  24.     _strtime(&ldate[9]);
  25.     ldate[17] = ' ';
  26.     ldate[18] = ' ';
  27.     write(logfilehandle,ldate,19);
  28.  
  29.     write(logfilehandle,chBuffer,sLength);
  30.     write(logfilehandle,"\r\n",2);
  31. }
  32.