home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / vfwprint.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  2KB  |  70 lines

  1. /***
  2. *vfwprintf.c - fwprintf from variable arg list
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       defines vfwprintf() - print formatted output, but take args from
  8. *       a stdargs pointer.
  9. *
  10. *******************************************************************************/
  11.  
  12.  
  13. #include <cruntime.h>
  14. #include <stdio.h>
  15. #include <wchar.h>
  16. #include <dbgint.h>
  17. #include <stdarg.h>
  18. #include <file2.h>
  19. #include <internal.h>
  20. #include <mtdll.h>
  21.  
  22. /***
  23. *int vfwprintf(stream, format, ap) - print to file from varargs
  24. *
  25. *Purpose:
  26. *       Performs formatted output to a file.  The arg list is a variable
  27. *       argument list pointer.
  28. *
  29. *Entry:
  30. *       FILE *stream - stream to write data to
  31. *       wchar_t *format - format string containing data format
  32. *       va_list ap - variable arg list pointer
  33. *
  34. *Exit:
  35. *       returns number of correctly output wide characters
  36. *       returns negative number if error occurred
  37. *
  38. *Exceptions:
  39. *
  40. *******************************************************************************/
  41.  
  42. int __cdecl vfwprintf (
  43.         FILE *str,
  44.         const wchar_t *format,
  45.         va_list ap
  46.         )
  47. /*
  48.  * 'V'ariable argument 'F'ile (stream) 'W'char_t 'PRINT', 'F'ormatted
  49.  */
  50. {
  51.         REG1 FILE *stream;
  52.         REG2 int buffing;
  53.         REG3 int retval;
  54.  
  55.         _ASSERTE(str != NULL);
  56.         _ASSERTE(format != NULL);
  57.  
  58.         /* Init stream pointer */
  59.         stream = str;
  60.  
  61.         _lock_str(stream);
  62.         buffing = _stbuf(stream);
  63.         retval = _woutput(stream,format,ap );
  64.         _ftbuf(buffing, stream);
  65.         _unlock_str(stream);
  66.  
  67.         return(retval);
  68. }
  69.  
  70.