1 // 2 // corecrt_wconio.h 3 // 4 // Copyright (c) Microsoft Corporation. All rights reserved. 5 // 6 // This file declares the wide character (wchar_t) console I/O functionality, 7 // shared by both <conio.h> and <wchar.h> 8 // 9 #pragma once 10 11 #include <corecrt.h> 12 #include <corecrt_stdio_config.h> 13 14 #pragma warning(push) 15 #pragma warning(disable: _UCRT_DISABLED_WARNINGS) 16 _UCRT_DISABLE_CLANG_WARNINGS 17 18 _CRT_BEGIN_C_HEADER 19 20 #define WEOF ((wint_t)(0xFFFF)) 21 22 23 24 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP 25 26 _Check_return_wat_ 27 _Success_(_BufferCount > 0) 28 _DCRTIMP errno_t __cdecl _cgetws_s( 29 _Out_writes_to_(_BufferCount, *_SizeRead) wchar_t* _Buffer, 30 _In_ size_t _BufferCount, 31 _Out_ size_t* _SizeRead 32 ); 33 34 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1( 35 _Success_(return == 0) 36 errno_t, _cgetws_s, 37 _Out_writes_z_(*_Buffer) wchar_t, _Buffer, 38 _In_ size_t*, _SizeRead 39 ) 40 41 _Check_return_opt_ 42 _DCRTIMP int __cdecl _cputws( 43 _In_z_ wchar_t const* _Buffer 44 ); 45 46 _Check_return_ _DCRTIMP wint_t __cdecl _getwch (void); 47 _Check_return_ _DCRTIMP wint_t __cdecl _getwche (void); 48 _Check_return_opt_ _DCRTIMP wint_t __cdecl _putwch (_In_ wchar_t _Character); 49 _Check_return_opt_ _DCRTIMP wint_t __cdecl _ungetwch(_In_ wint_t _Character); 50 51 _Check_return_ _DCRTIMP wint_t __cdecl _getwch_nolock (void); 52 _Check_return_ _DCRTIMP wint_t __cdecl _getwche_nolock (void); 53 _Check_return_opt_ _DCRTIMP wint_t __cdecl _putwch_nolock (_In_ wchar_t _Character); 54 _Check_return_opt_ _DCRTIMP wint_t __cdecl _ungetwch_nolock(_In_ wint_t _Character); 55 56 57 58 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 59 // 60 // Wide Character Formatted Output Functions (Console) 61 // 62 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 63 _Check_return_opt_ 64 _DCRTIMP int __cdecl __conio_common_vcwprintf( 65 _In_ unsigned __int64 _Options, 66 _In_z_ _Printf_format_string_params_(2) wchar_t const* _Format, 67 _In_opt_ _locale_t _Locale, 68 va_list _ArgList 69 ); 70 71 _Check_return_opt_ 72 _DCRTIMP int __cdecl __conio_common_vcwprintf_s( 73 _In_ unsigned __int64 _Options, 74 _In_z_ _Printf_format_string_params_(2) wchar_t const* _Format, 75 _In_opt_ _locale_t _Locale, 76 va_list _ArgList 77 ); 78 79 _Check_return_opt_ 80 _DCRTIMP int __cdecl __conio_common_vcwprintf_p( 81 _In_ unsigned __int64 _Options, 82 _In_z_ _Printf_format_string_params_(2) wchar_t const* _Format, 83 _In_opt_ _locale_t _Locale, 84 va_list _ArgList 85 ); 86 87 _Check_return_opt_ 88 _CRT_STDIO_INLINE int __CRTDECL _vcwprintf_l( 89 _In_z_ _Printf_format_string_params_(2) wchar_t const* const _Format, 90 _In_opt_ _locale_t const _Locale, 91 va_list _ArgList 92 ) 93 #if defined _NO_CRT_STDIO_INLINE 94 ; 95 #else 96 { 97 return __conio_common_vcwprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Format, _Locale, _ArgList); 98 } 99 #endif 100 101 _Check_return_opt_ 102 _CRT_STDIO_INLINE int __CRTDECL _vcwprintf( 103 _In_z_ _Printf_format_string_ wchar_t const* const _Format, 104 va_list _ArgList 105 ) 106 #if defined _NO_CRT_STDIO_INLINE 107 ; 108 #else 109 { 110 return _vcwprintf_l(_Format, NULL, _ArgList); 111 } 112 #endif 113 114 _Check_return_opt_ 115 _CRT_STDIO_INLINE int __CRTDECL _vcwprintf_s_l( 116 _In_z_ _Printf_format_string_params_(2) wchar_t const* const _Format, 117 _In_opt_ _locale_t const _Locale, 118 va_list _ArgList 119 ) 120 #if defined _NO_CRT_STDIO_INLINE 121 ; 122 #else 123 { 124 return __conio_common_vcwprintf_s(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Format, _Locale, _ArgList); 125 } 126 #endif 127 128 _Check_return_opt_ 129 _CRT_STDIO_INLINE int __CRTDECL _vcwprintf_s( 130 _In_z_ _Printf_format_string_ wchar_t const* const _Format, 131 va_list _ArgList 132 ) 133 #if defined _NO_CRT_STDIO_INLINE 134 ; 135 #else 136 { 137 return _vcwprintf_s_l(_Format, NULL, _ArgList); 138 } 139 #endif 140 141 _Check_return_opt_ 142 _CRT_STDIO_INLINE int __CRTDECL _vcwprintf_p_l( 143 _In_z_ _Printf_format_string_params_(2) wchar_t const* const _Format, 144 _In_opt_ _locale_t const _Locale, 145 va_list _ArgList 146 ) 147 #if defined _NO_CRT_STDIO_INLINE 148 ; 149 #else 150 { 151 return __conio_common_vcwprintf_p(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Format, _Locale, _ArgList); 152 } 153 #endif 154 155 _Check_return_opt_ 156 _CRT_STDIO_INLINE int __CRTDECL _vcwprintf_p( 157 _In_z_ _Printf_format_string_ const wchar_t* const _Format, 158 va_list _ArgList 159 ) 160 #if defined _NO_CRT_STDIO_INLINE 161 ; 162 #else 163 { 164 return _vcwprintf_p_l(_Format, NULL, _ArgList); 165 } 166 #endif 167 168 _Check_return_opt_ 169 _CRT_STDIO_INLINE int __CRTDECL _cwprintf_l( 170 _In_z_ _Printf_format_string_params_(0) wchar_t const* const _Format, 171 _In_opt_ _locale_t const _Locale, 172 ...) 173 #if defined _NO_CRT_STDIO_INLINE 174 ; 175 #else 176 { 177 int _Result; 178 va_list _ArgList; 179 __crt_va_start(_ArgList, _Locale); 180 _Result = _vcwprintf_l(_Format, _Locale, _ArgList); 181 __crt_va_end(_ArgList); 182 return _Result; 183 } 184 #endif 185 186 _Check_return_opt_ 187 _CRT_STDIO_INLINE int __CRTDECL _cwprintf( 188 _In_z_ _Printf_format_string_ wchar_t const* const _Format, 189 ...) 190 #if defined _NO_CRT_STDIO_INLINE 191 ; 192 #else 193 { 194 int _Result; 195 va_list _ArgList; 196 __crt_va_start(_ArgList, _Format); 197 _Result = _vcwprintf_l(_Format, NULL, _ArgList); 198 __crt_va_end(_ArgList); 199 return _Result; 200 } 201 #endif 202 203 _Check_return_opt_ 204 _CRT_STDIO_INLINE int __CRTDECL _cwprintf_s_l( 205 _In_z_ _Printf_format_string_params_(0) wchar_t const* const _Format, 206 _In_opt_ _locale_t const _Locale, 207 ...) 208 #if defined _NO_CRT_STDIO_INLINE 209 ; 210 #else 211 { 212 int _Result; 213 va_list _ArgList; 214 __crt_va_start(_ArgList, _Locale); 215 _Result = _vcwprintf_s_l(_Format, _Locale, _ArgList); 216 __crt_va_end(_ArgList); 217 return _Result; 218 } 219 #endif 220 221 _Check_return_opt_ 222 _CRT_STDIO_INLINE int __CRTDECL _cwprintf_s( 223 _In_z_ _Printf_format_string_ wchar_t const* const _Format, 224 ...) 225 #if defined _NO_CRT_STDIO_INLINE 226 ; 227 #else 228 { 229 int _Result; 230 va_list _ArgList; 231 __crt_va_start(_ArgList, _Format); 232 _Result = _vcwprintf_s_l(_Format, NULL, _ArgList); 233 __crt_va_end(_ArgList); 234 return _Result; 235 } 236 #endif 237 238 _Check_return_opt_ 239 _CRT_STDIO_INLINE int __CRTDECL _cwprintf_p_l( 240 _In_z_ _Printf_format_string_params_(0) wchar_t const* const _Format, 241 _In_opt_ _locale_t const _Locale, 242 ...) 243 #if defined _NO_CRT_STDIO_INLINE 244 ; 245 #else 246 { 247 int _Result; 248 va_list _ArgList; 249 __crt_va_start(_ArgList, _Locale); 250 _Result = _vcwprintf_p_l(_Format, _Locale, _ArgList); 251 __crt_va_end(_ArgList); 252 return _Result; 253 } 254 #endif 255 256 _Check_return_opt_ 257 _CRT_STDIO_INLINE int __CRTDECL _cwprintf_p( 258 _In_z_ _Printf_format_string_ wchar_t const* const _Format, 259 ...) 260 #if defined _NO_CRT_STDIO_INLINE 261 ; 262 #else 263 { 264 int _Result; 265 va_list _ArgList; 266 __crt_va_start(_ArgList, _Format); 267 _Result = _vcwprintf_p_l(_Format, NULL, _ArgList); 268 __crt_va_end(_ArgList); 269 return _Result; 270 } 271 #endif 272 273 274 275 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 276 // 277 // Wide Character Formatted Input Functions (Console) 278 // 279 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 280 _Check_return_opt_ 281 _DCRTIMP int __cdecl __conio_common_vcwscanf( 282 _In_ unsigned __int64 _Options, 283 _In_z_ _Scanf_format_string_params_(2) wchar_t const* _Format, 284 _In_opt_ _locale_t _Locale, 285 va_list _ArgList 286 ); 287 288 _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_vcwscanf_s_l) 289 _CRT_STDIO_INLINE int __CRTDECL _vcwscanf_l( 290 _In_z_ _Scanf_format_string_params_(2) wchar_t const* const _Format, 291 _In_opt_ _locale_t const _Locale, 292 va_list _ArgList 293 ) 294 #if defined _NO_CRT_STDIO_INLINE 295 ; 296 #else 297 { 298 return __conio_common_vcwscanf( 299 _CRT_INTERNAL_LOCAL_SCANF_OPTIONS, 300 _Format, _Locale, _ArgList); 301 } 302 #endif 303 304 _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_vcwscanf_s) 305 _CRT_STDIO_INLINE int __CRTDECL _vcwscanf( 306 _In_z_ _Scanf_format_string_params_(1) wchar_t const* const _Format, 307 va_list _ArgList 308 ) 309 #if defined _NO_CRT_STDIO_INLINE 310 ; 311 #else 312 { 313 return _vcwscanf_l(_Format, NULL, _ArgList); 314 } 315 #endif 316 317 _Check_return_opt_ 318 _CRT_STDIO_INLINE int __CRTDECL _vcwscanf_s_l( 319 _In_z_ _Scanf_format_string_params_(2) wchar_t const* const _Format, 320 _In_opt_ _locale_t const _Locale, 321 va_list _ArgList 322 ) 323 #if defined _NO_CRT_STDIO_INLINE 324 ; 325 #else 326 { 327 return __conio_common_vcwscanf( 328 _CRT_INTERNAL_LOCAL_SCANF_OPTIONS | _CRT_INTERNAL_SCANF_SECURECRT, 329 _Format, _Locale, _ArgList); 330 } 331 #endif 332 333 _Check_return_opt_ 334 _CRT_STDIO_INLINE int __CRTDECL _vcwscanf_s( 335 _In_z_ _Scanf_format_string_params_(1) wchar_t const* const _Format, 336 va_list _ArgList 337 ) 338 #if defined _NO_CRT_STDIO_INLINE 339 ; 340 #else 341 { 342 return _vcwscanf_s_l(_Format, NULL, _ArgList); 343 } 344 #endif 345 346 _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_cwscanf_s_l) 347 _CRT_STDIO_INLINE int __CRTDECL _cwscanf_l( 348 _In_z_ _Scanf_format_string_params_(0) wchar_t const* const _Format, 349 _In_opt_ _locale_t const _Locale, 350 ...) 351 #if defined _NO_CRT_STDIO_INLINE 352 ; 353 #else 354 { 355 int _Result; 356 va_list _ArgList; 357 __crt_va_start(_ArgList, _Locale); 358 359 _Result = _vcwscanf_l(_Format, _Locale, _ArgList); 360 361 __crt_va_end(_ArgList); 362 return _Result; 363 } 364 #endif 365 366 _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_cwscanf_s) 367 _CRT_STDIO_INLINE int __CRTDECL _cwscanf( 368 _In_z_ _Scanf_format_string_ wchar_t const* const _Format, 369 ...) 370 #if defined _NO_CRT_STDIO_INLINE 371 ; 372 #else 373 { 374 int _Result; 375 va_list _ArgList; 376 __crt_va_start(_ArgList, _Format); 377 378 _Result = _vcwscanf_l(_Format, NULL, _ArgList); 379 380 __crt_va_end(_ArgList); 381 return _Result; 382 } 383 #endif 384 385 _Check_return_opt_ 386 _CRT_STDIO_INLINE int __CRTDECL _cwscanf_s_l( 387 _In_z_ _Scanf_format_string_params_(0) wchar_t const* const _Format, 388 _In_opt_ _locale_t const _Locale, 389 ...) 390 #if defined _NO_CRT_STDIO_INLINE 391 ; 392 #else 393 { 394 int _Result; 395 va_list _ArgList; 396 __crt_va_start(_ArgList, _Locale); 397 _Result = _vcwscanf_s_l(_Format, _Locale, _ArgList); 398 __crt_va_end(_ArgList); 399 return _Result; 400 } 401 #endif 402 403 _Check_return_opt_ 404 _CRT_STDIO_INLINE int __CRTDECL _cwscanf_s( 405 _In_z_ _Scanf_format_string_ wchar_t const* const _Format, 406 ...) 407 #if defined _NO_CRT_STDIO_INLINE 408 ; 409 #else 410 { 411 int _Result; 412 va_list _ArgList; 413 __crt_va_start(_ArgList, _Format); 414 _Result = _vcwscanf_s_l(_Format, NULL, _ArgList); 415 __crt_va_end(_ArgList); 416 return _Result; 417 } 418 #endif 419 420 #endif // _CRT_USE_WINAPI_FAMILY_DESKTOP_APP 421 422 _CRT_END_C_HEADER 423 _UCRT_RESTORE_CLANG_WARNINGS 424 #pragma warning(pop) // _UCRT_DISABLED_WARNINGS 425