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

  1. /***
  2. *wscanf.c - read formatted data from stdin
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       defines wscanf() - reads formatted data from stdin
  8. *
  9. *******************************************************************************/
  10.  
  11.  
  12. #include <cruntime.h>
  13. #include <stdio.h>
  14. #include <wchar.h>
  15. #include <dbgint.h>
  16. #include <stdarg.h>
  17. #include <file2.h>
  18. #include <internal.h>
  19. #include <mtdll.h>
  20.  
  21. /***
  22. *int wscanf(format, ...) - read formatted data from stdin
  23. *
  24. *Purpose:
  25. *       Reads formatted data from stdin into arguments.  _input does the real
  26. *       work here.
  27. *
  28. *Entry:
  29. *       char *format - format string
  30. *       followed by list of pointers to storage for the data read.  The number
  31. *       and type are controlled by the format string.
  32. *
  33. *Exit:
  34. *       returns number of fields read and assigned
  35. *
  36. *Exceptions:
  37. *
  38. *******************************************************************************/
  39.  
  40. int __cdecl wscanf (
  41.         const wchar_t *format,
  42.         ...
  43.         )
  44. /*
  45.  * stdin 'W'char_t 'SCAN', 'F'ormatted
  46.  */
  47. {
  48.         int retval;
  49.  
  50.         va_list arglist;
  51.  
  52. // UNDONE: make va_start work with wchar_t format string
  53.         va_start(arglist, format);
  54.  
  55.         _ASSERTE(format != NULL);
  56.  
  57.         _lock_str2(0, stdin);
  58.  
  59.         retval = (_winput(stdin,format,arglist));
  60.  
  61.         _unlock_str2(0, stdin);
  62.  
  63.         return(retval);
  64. }
  65.  
  66.