home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / npmeta.zip / PPRINTF.CPP < prev    next >
C/C++ Source or Header  |  1997-04-09  |  476b  |  21 lines

  1. #include <stdarg.h>
  2. #include <stdio.h>
  3. #include <pprintf.h>
  4. #define INCL_DOSNMPIPES
  5. #include <os2.h>
  6.  
  7. static char s[1024]={0};
  8.  
  9. int pprintf( const char* szPipe, const char* szFmt, ... ) {
  10.   va_list lst;
  11.   va_start( lst, szFmt );
  12.   int n=vsprintf( s, szFmt, lst );
  13.   va_end( lst );
  14.   if ( n>0 ) { // write string to pipe
  15.     const to=1000; // 1 sec
  16.     ULONG dummy=0;
  17.     DosCallNPipe( szPipe, s, n, &dummy, sizeof( dummy ), &dummy, to );
  18.   }
  19.   return n;
  20. }
  21.