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

  1. /***
  2. *fwprintf.c - print formatted data to stream
  3. *
  4. *       Copyright (c) 1992-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       defines fwprintf() - print formatted data to stream
  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 fwprintf(stream, format, ...) - print formatted data
  22. *
  23. *Purpose:
  24. *       Prints formatted data on the given using the format string to
  25. *       format data and getting as many arguments as called for
  26. *       _output does the real work here
  27. *
  28. *Entry:
  29. *       FILE *stream - stream to print on
  30. *       wchar_t *format - format string to control data format/number of arguments
  31. *       followed by arguments to print, 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 fwprintf (
  42.         FILE *str,
  43.         const wchar_t *format,
  44.         ...
  45.         )
  46. /*
  47.  * 'F'ile (stream) 'W'char_t 'PRINT', 'F'ormatted
  48.  */
  49. {
  50.         va_list(arglist);
  51.         REG1 FILE *stream;
  52.         REG2 int buffing;
  53.         int retval;
  54.  
  55. // UNDONE: make va_start work with wchar_t format string
  56.         va_start(arglist, format);
  57.  
  58.         _ASSERTE(str != NULL);
  59.         _ASSERTE(format != NULL);
  60.  
  61.         /* Init stream pointer */
  62.         stream = str;
  63.  
  64.         _lock_str(stream);
  65.         buffing = _stbuf(stream);
  66.         retval = _woutput(stream,format,arglist);
  67.         _ftbuf(buffing, stream);
  68.         _unlock_str(stream);
  69.  
  70.         return(retval);
  71. }
  72.  
  73.