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

  1. /***
  2. *vprintf.c - printf from a var args pointer
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       defines vprintf() - print formatted data from an argument list pointer
  8. *
  9. *******************************************************************************/
  10.  
  11. #include <cruntime.h>
  12. #include <stdio.h>
  13. #include <dbgint.h>
  14. #include <stdarg.h>
  15. #include <internal.h>
  16. #include <file2.h>
  17. #include <mtdll.h>
  18.  
  19. /***
  20. *int vprintf(format, ap) - print formatted data from an argument list pointer
  21. *
  22. *Purpose:
  23. *       Prints formatted data items to stdout.  Uses a pointer to a
  24. *       variable length list of arguments instead of an argument list.
  25. *
  26. *Entry:
  27. *       char *format - format string, describes data format to write
  28. *       va_list ap - pointer to variable length arg list
  29. *
  30. *Exit:
  31. *       returns number of characters written
  32. *
  33. *Exceptions:
  34. *
  35. *******************************************************************************/
  36.  
  37. int __cdecl vprintf (
  38.         const char *format,
  39.         va_list ap
  40.         )
  41. /*
  42.  * stdout 'V'ariable, 'PRINT', 'F'ormatted
  43.  */
  44. {
  45.         REG1 FILE *stream = stdout;
  46.         REG2 int buffing;
  47.         REG3 int retval;
  48.  
  49.         _ASSERTE(format != NULL);
  50.  
  51.         _lock_str(stream);
  52.         buffing = _stbuf(stream);
  53.         retval = _output(stream, format, ap );
  54.         _ftbuf(buffing, stream);
  55.         _unlock_str(stream);
  56.  
  57.         return(retval);
  58. }
  59.