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.

86 lines
1.9 KiB

  1. /***
  2. *fwscanf.c - read formatted data from stream
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * defines fwscanf() - reads formatted data from stream
  8. *
  9. *Revision History:
  10. * 05-16-92 KRS Created from fscanf.c.
  11. * 04-06-93 SKS Replace _CRTAPI* with __cdecl
  12. * 02-07-94 CFW POSIXify.
  13. * 09-06-94 CFW Replace MTHREAD with _MT.
  14. * 02-06-94 CFW assert -> _ASSERTE.
  15. * 03-07-95 GJF _[un]lock_str macros now take FILE * arg.
  16. * 03-02-98 GJF Exception-safe locking.
  17. *
  18. *******************************************************************************/
  19. #ifndef _POSIX_
  20. #include <cruntime.h>
  21. #include <stdio.h>
  22. #include <wchar.h>
  23. #include <dbgint.h>
  24. #include <stdarg.h>
  25. #include <file2.h>
  26. #include <internal.h>
  27. #include <mtdll.h>
  28. /***
  29. *int fwscanf(stream, format, ...) - read formatted data from stream
  30. *
  31. *Purpose:
  32. * Reads formatted data from stream into arguments. _input does the real
  33. * work here.
  34. *
  35. *Entry:
  36. * FILE *stream - stream to read data from
  37. * wchar_t *format - format string
  38. * followed by list of pointers to storage for the data read. The number
  39. * and type are controlled by the format string.
  40. *
  41. *Exit:
  42. * returns number of fields read and assigned
  43. *
  44. *Exceptions:
  45. *
  46. *******************************************************************************/
  47. int __cdecl fwscanf (
  48. FILE *stream,
  49. const wchar_t *format,
  50. ...
  51. )
  52. /*
  53. * 'F'ile (stream) 'W'char_t 'SCAN', 'F'ormatted
  54. */
  55. {
  56. int retval;
  57. va_list arglist;
  58. va_start(arglist, format);
  59. _ASSERTE(stream != NULL);
  60. _ASSERTE(format != NULL);
  61. #ifdef _MT
  62. _lock_str(stream);
  63. __try {
  64. #endif
  65. retval = (_winput(stream,format,arglist));
  66. #ifdef _MT
  67. }
  68. __finally {
  69. _unlock_str(stream);
  70. }
  71. #endif
  72. return(retval);
  73. }
  74. #endif /* _POSIX_ */