xref: /reactos/sdk/lib/ucrt/conio/cscanf.cpp (revision e3e520d1)
1 //
2 // cscanf.cpp
3 //
4 //      Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // The core formatted input functions for direct console I/O.
7 //
8 #define _ALLOW_OLD_VALIDATE_MACROS
9 #include <corecrt_internal_stdio_input.h>
10 
11 using namespace __crt_stdio_input;
12 
13 template <typename Character>
14 static int __cdecl common_cscanf(
15     unsigned __int64 const options,
16     Character const* const format,
17     _locale_t        const locale,
18     va_list          const arglist
19     ) throw()
20 {
21     typedef input_processor<
22         Character,
23         console_input_adapter<Character>
24     > processor_type;
25 
26     _LocaleUpdate locale_update(locale);
27 
28     processor_type processor(
29         console_input_adapter<Character>(),
30         options,
31         format,
32         locale_update.GetLocaleT(),
33         arglist);
34 
35     return processor.process();
36 }
37 
38 extern "C" int __cdecl __conio_common_vcscanf(
39     unsigned __int64 const options,
40     char const*      const format,
41     _locale_t        const locale,
42     va_list          const arglist
43     )
44 {
45     return common_cscanf(options, format, locale, arglist);
46 }
47 
48 extern "C" int __cdecl __conio_common_vcwscanf(
49     unsigned __int64 const options,
50     wchar_t const*   const format,
51     _locale_t        const locale,
52     va_list          const arglist
53     )
54 {
55     return common_cscanf(options, format, locale, arglist);
56 }
57