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

  1. /***
  2. *wprintf.c - print formatted
  3. *
  4. *       Copyright (c) 1992-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       defines wprintf() - print formatted data
  8. *
  9. *******************************************************************************/
  10.  
  11.  
  12. #include <cruntime.h>
  13. #include <stdio.h>
  14. #include <dbgint.h>
  15. #include <stdarg.h>
  16. #include <file2.h>
  17. #include <internal.h>
  18. #include <mtdll.h>
  19.  
  20. /***
  21. *int wprintf(format, ...) - print formatted data
  22. *
  23. *Purpose:
  24. *       Prints formatted data on stdout using the format string to
  25. *       format data and getting as many arguments as called for
  26. *       Uses temporary buffering to improve efficiency.
  27. *       _output does the real work here
  28. *
  29. *Entry:
  30. *       wchar_t *format - format string to control data format/number of arguments
  31. *       followed by list of arguments, number and type controlled by
  32. *       format string
  33. *
  34. *Exit:
  35. *       returns number of wide characters printed
  36. *
  37. *Exceptions:
  38. *
  39. *******************************************************************************/
  40.  
  41. int __cdecl wprintf (
  42.         const wchar_t *format,
  43.         ...
  44.         )
  45. /*
  46.  * stdout 'W'char_t 'PRINT', 'F'ormatted
  47.  */
  48. {
  49.         va_list arglist;
  50.         int buffing;
  51.         int retval;
  52.  
  53. // UNDONE: make va_start work with wchar_t format string
  54.         va_start(arglist, format);
  55.  
  56.         _ASSERTE(format != NULL);
  57.  
  58.         _lock_str2(1, stdout);
  59.  
  60.         buffing = _stbuf(stdout);
  61.  
  62.         retval = _woutput(stdout,format,arglist);
  63.  
  64.         _ftbuf(buffing, stdout);
  65.  
  66.         _unlock_str2(1, stdout);
  67.  
  68.         return(retval);
  69. }
  70.  
  71.