Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.1 KiB

  1. /***
  2. *vfwprintf.c - fwprintf from variable arg list
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * defines vfwprintf() - print formatted output, but take args from
  8. * a stdargs pointer.
  9. *
  10. *Revision History:
  11. * 05-16-92 KRS Created from vfprintf.c.
  12. * 04-06-93 SKS Replace _CRTAPI* with __cdecl
  13. * 02-07-94 CFW POSIXify.
  14. * 09-06-94 CFW Replace MTHREAD with _MT.
  15. * 02-06-94 CFW assert -> _ASSERTE.
  16. * 03-07-95 GJF _[un]lock_str macros now take FILE * arg.
  17. * 03-02-98 GJF Exception-safe locking.
  18. *
  19. *******************************************************************************/
  20. #ifndef _POSIX_
  21. #include <cruntime.h>
  22. #include <stdio.h>
  23. #include <wchar.h>
  24. #include <dbgint.h>
  25. #include <stdarg.h>
  26. #include <file2.h>
  27. #include <internal.h>
  28. #include <mtdll.h>
  29. /***
  30. *int vfwprintf(stream, format, ap) - print to file from varargs
  31. *
  32. *Purpose:
  33. * Performs formatted output to a file. The arg list is a variable
  34. * argument list pointer.
  35. *
  36. *Entry:
  37. * FILE *stream - stream to write data to
  38. * wchar_t *format - format string containing data format
  39. * va_list ap - variable arg list pointer
  40. *
  41. *Exit:
  42. * returns number of correctly output wide characters
  43. * returns negative number if error occurred
  44. *
  45. *Exceptions:
  46. *
  47. *******************************************************************************/
  48. int __cdecl vfwprintf (
  49. FILE *str,
  50. const wchar_t *format,
  51. va_list ap
  52. )
  53. /*
  54. * 'V'ariable argument 'F'ile (stream) 'W'char_t 'PRINT', 'F'ormatted
  55. */
  56. {
  57. REG1 FILE *stream;
  58. REG2 int buffing;
  59. REG3 int retval;
  60. _ASSERTE(str != NULL);
  61. _ASSERTE(format != NULL);
  62. /* Init stream pointer */
  63. stream = str;
  64. #ifdef _MT
  65. _lock_str(stream);
  66. __try {
  67. #endif
  68. buffing = _stbuf(stream);
  69. retval = _woutput(stream,format,ap );
  70. _ftbuf(buffing, stream);
  71. #ifdef _MT
  72. }
  73. __finally {
  74. _unlock_str(stream);
  75. }
  76. #endif
  77. return(retval);
  78. }
  79. #endif /* _POSIX_ */