home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / VIDEO / WMVPRINT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  1010 b   |  45 lines

  1. /* wmvprint.c (emx+gcc) -- Copyright (c) 1987-1993 by Eberhard Mattes */
  2.  
  3. #include <sys/emx.h>
  4. #include <stdio.h>
  5. #include <stdarg.h>
  6. #include <sys/winmgr.h>
  7. #include "winmgr2.h"
  8.  
  9. static int _wm_flush (FILE *stream, int c)
  10. {
  11.   int n;
  12.   wm_handle wh;
  13.  
  14.   wh = (wm_handle)stream->tmpidx;
  15.   n = stream->ptr - stream->buffer;
  16.   if (n > 0)
  17.     _wm_puts_len (wh, stream->buffer, n);
  18.   stream->ptr = stream->buffer;
  19.   *stream->ptr++ = (char)c;
  20.   stream->wcount = stream->buf_size - 1;
  21.   return (0);
  22. }
  23.  
  24.  
  25. int wm_vprintf (wm_handle wh, const char *fmt, va_list arg_ptr)
  26. {
  27.   FILE trick;
  28.   int result;
  29.   char buf[512];
  30.  
  31.   trick.buffer = buf;
  32.   trick.ptr = buf;
  33.   trick.rcount = 0;
  34.   trick.wcount = sizeof (buf);
  35.   trick.handle = -1;
  36.   trick.flags = _IOOPEN|_IOSTRING|_IOBUFUSER|_IOWRT;
  37.   trick.buf_size = sizeof (buf);
  38.   trick.flush = _wm_flush;
  39.   trick.tmpidx = (int)wh;
  40.   result = _output (&trick, fmt, arg_ptr);
  41.   _wm_flush (&trick, 0);
  42.   _wm_cursor1 ();
  43.   return (result);
  44. }
  45.