1 // 2 // conio.h 3 // 4 // Copyright (c) Microsoft Corporation. All rights reserved. 5 // 6 // This file declares the direct console I/O functions. 7 // 8 #pragma once 9 #ifndef _INC_CONIO // include guard for 3rd party interop 10 #define _INC_CONIO 11 12 #include <corecrt.h> 13 #include <corecrt_wconio.h> 14 15 #pragma warning(push) 16 #pragma warning(disable: _UCRT_DISABLED_WARNINGS) 17 _UCRT_DISABLE_CLANG_WARNINGS 18 19 _CRT_BEGIN_C_HEADER 20 21 _Check_return_wat_ 22 _Success_(_BufferCount > 0) 23 _DCRTIMP errno_t __cdecl _cgets_s( 24 _Out_writes_z_(_BufferCount) char* _Buffer, 25 _In_ size_t _BufferCount, 26 _Out_ size_t* _SizeRead 27 ); 28 29 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1( 30 _Success_(return == 0) 31 errno_t, _cgets_s, 32 _Out_writes_z_(*_Buffer) char, _Buffer, 33 _Out_ size_t*, _SizeRead 34 ) 35 36 _Check_return_opt_ 37 _DCRTIMP int __cdecl _cputs( 38 _In_z_ char const* _Buffer 39 ); 40 41 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 42 // 43 // Narrow Character Formatted Output Functions (Console) 44 // 45 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 46 _Check_return_opt_ 47 _DCRTIMP int __cdecl __conio_common_vcprintf( 48 _In_ unsigned __int64 _Options, 49 _In_z_ _Printf_format_string_params_(2) char const* _Format, 50 _In_opt_ _locale_t _Locale, 51 va_list _ArgList 52 ); 53 54 _Check_return_opt_ 55 _DCRTIMP int __cdecl __conio_common_vcprintf_s( 56 _In_ unsigned __int64 _Options, 57 _In_z_ _Printf_format_string_params_(2) char const* _Format, 58 _In_opt_ _locale_t _Locale, 59 va_list _ArgList 60 ); 61 62 _Check_return_opt_ 63 _DCRTIMP int __cdecl __conio_common_vcprintf_p( 64 _In_ unsigned __int64 _Options, 65 _In_z_ _Printf_format_string_params_(2) char const* _Format, 66 _In_opt_ _locale_t _Locale, 67 va_list _ArgList 68 ); 69 70 _Check_return_opt_ 71 _CRT_STDIO_INLINE int __CRTDECL _vcprintf_l( 72 _In_z_ _Printf_format_string_params_(2) char const* const _Format, 73 _In_opt_ _locale_t const _Locale, 74 va_list _ArgList 75 ) 76 #if defined _NO_CRT_STDIO_INLINE 77 ; 78 #else 79 { 80 return __conio_common_vcprintf( 81 _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, 82 _Format, _Locale, _ArgList); 83 } 84 #endif 85 86 _Check_return_opt_ 87 _CRT_STDIO_INLINE int __CRTDECL _vcprintf( 88 _In_z_ _Printf_format_string_ char const* const _Format, 89 va_list _ArgList 90 ) 91 #if defined _NO_CRT_STDIO_INLINE 92 ; 93 #else 94 { 95 return _vcprintf_l(_Format, NULL, _ArgList); 96 } 97 #endif 98 99 _Check_return_opt_ 100 _CRT_STDIO_INLINE int __CRTDECL _vcprintf_s_l( 101 _In_z_ _Printf_format_string_params_(2) char const* const _Format, 102 _In_opt_ _locale_t const _Locale, 103 va_list _ArgList 104 ) 105 #if defined _NO_CRT_STDIO_INLINE 106 ; 107 #else 108 { 109 return __conio_common_vcprintf_s( 110 _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, 111 _Format, _Locale, _ArgList); 112 } 113 #endif 114 115 _Check_return_opt_ 116 _CRT_STDIO_INLINE int __CRTDECL _vcprintf_s( 117 _In_z_ _Printf_format_string_ char const* const _Format, 118 va_list _ArgList 119 ) 120 #if defined _NO_CRT_STDIO_INLINE 121 ; 122 #else 123 { 124 return _vcprintf_s_l(_Format, NULL, _ArgList); 125 } 126 #endif 127 128 _Check_return_opt_ 129 _CRT_STDIO_INLINE int __CRTDECL _vcprintf_p_l( 130 _In_z_ _Printf_format_string_params_(2) char const* const _Format, 131 _In_opt_ _locale_t const _Locale, 132 va_list _ArgList 133 ) 134 #if defined _NO_CRT_STDIO_INLINE 135 ; 136 #else 137 { 138 return __conio_common_vcprintf_p( 139 _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, 140 _Format, _Locale, _ArgList); 141 } 142 #endif 143 144 _Check_return_opt_ 145 _CRT_STDIO_INLINE int __CRTDECL _vcprintf_p( 146 _In_z_ char const* const _Format, 147 va_list _ArgList 148 ) 149 #if defined _NO_CRT_STDIO_INLINE 150 ; 151 #else 152 { 153 return _vcprintf_p_l(_Format, NULL, _ArgList); 154 } 155 #endif 156 157 _Check_return_opt_ 158 _CRT_STDIO_INLINE int __CRTDECL _cprintf_l( 159 _In_z_ _Printf_format_string_params_(0) char const* const _Format, 160 _In_opt_ _locale_t const _Locale, 161 ...) 162 #if defined _NO_CRT_STDIO_INLINE 163 ; 164 #else 165 { 166 int _Result; 167 va_list _ArgList; 168 __crt_va_start(_ArgList, _Locale); 169 _Result = _vcprintf_l(_Format, _Locale, _ArgList); 170 __crt_va_end(_ArgList); 171 return _Result; 172 } 173 #endif 174 175 _Check_return_opt_ 176 _CRT_STDIO_INLINE int __CRTDECL _cprintf( 177 _In_z_ _Printf_format_string_ char const* const _Format, 178 ...) 179 #if defined _NO_CRT_STDIO_INLINE 180 ; 181 #else 182 { 183 int _Result; 184 va_list _ArgList; 185 __crt_va_start(_ArgList, _Format); 186 _Result = _vcprintf_l(_Format, NULL, _ArgList); 187 __crt_va_end(_ArgList); 188 return _Result; 189 } 190 #endif 191 192 _Check_return_opt_ 193 _CRT_STDIO_INLINE int __CRTDECL _cprintf_s_l( 194 _In_z_ _Printf_format_string_params_(0) char const* const _Format, 195 _In_opt_ _locale_t const _Locale, 196 ...) 197 #if defined _NO_CRT_STDIO_INLINE 198 ; 199 #else 200 { 201 int _Result; 202 va_list _ArgList; 203 __crt_va_start(_ArgList, _Locale); 204 _Result = _vcprintf_s_l(_Format, _Locale, _ArgList); 205 __crt_va_end(_ArgList); 206 return _Result; 207 } 208 #endif 209 210 _Check_return_opt_ 211 _CRT_STDIO_INLINE int __CRTDECL _cprintf_s( 212 _In_z_ _Printf_format_string_ char const* const _Format, 213 ...) 214 #if defined _NO_CRT_STDIO_INLINE 215 ; 216 #else 217 { 218 int _Result; 219 va_list _ArgList; 220 __crt_va_start(_ArgList, _Format); 221 _Result = _vcprintf_s_l(_Format, NULL, _ArgList); 222 __crt_va_end(_ArgList); 223 return _Result; 224 } 225 #endif 226 227 _Check_return_opt_ 228 _CRT_STDIO_INLINE int __CRTDECL _cprintf_p_l( 229 _In_z_ _Printf_format_string_params_(0) char const* const _Format, 230 _In_opt_ _locale_t const _Locale, 231 ...) 232 #if defined _NO_CRT_STDIO_INLINE 233 ; 234 #else 235 { 236 int _Result; 237 va_list _ArgList; 238 __crt_va_start(_ArgList, _Locale); 239 _Result = _vcprintf_p_l(_Format, _Locale, _ArgList); 240 __crt_va_end(_ArgList); 241 return _Result; 242 } 243 #endif 244 245 _Check_return_opt_ 246 _CRT_STDIO_INLINE int __CRTDECL _cprintf_p( 247 _In_z_ _Printf_format_string_ char const* const _Format, 248 ...) 249 #if defined _NO_CRT_STDIO_INLINE 250 ; 251 #else 252 { 253 int _Result; 254 va_list _ArgList; 255 __crt_va_start(_ArgList, _Format); 256 _Result = _vcprintf_p_l(_Format, NULL, _ArgList); 257 __crt_va_end(_ArgList); 258 return _Result; 259 } 260 #endif 261 262 263 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 264 // 265 // Narrow Character Formatted Input Functions (Console) 266 // 267 //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 268 _Check_return_opt_ 269 _DCRTIMP int __cdecl __conio_common_vcscanf( 270 _In_ unsigned __int64 _Options, 271 _In_z_ _Scanf_format_string_params_(2) char const* _Format, 272 _In_opt_ _locale_t _Locale, 273 va_list _ArgList 274 ); 275 276 _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_vcscanf_s_l) 277 _CRT_STDIO_INLINE int __CRTDECL _vcscanf_l( 278 _In_z_ _Scanf_format_string_params_(2) char const* const _Format, 279 _In_opt_ _locale_t const _Locale, 280 va_list _ArgList 281 ) 282 #if defined _NO_CRT_STDIO_INLINE 283 ; 284 #else 285 { 286 return __conio_common_vcscanf( 287 _CRT_INTERNAL_LOCAL_SCANF_OPTIONS, 288 _Format, _Locale, _ArgList); 289 } 290 #endif 291 292 _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_vcscanf_s) 293 _CRT_STDIO_INLINE int __CRTDECL _vcscanf( 294 _In_z_ _Scanf_format_string_params_(1) char const* const _Format, 295 va_list _ArgList 296 ) 297 #if defined _NO_CRT_STDIO_INLINE 298 ; 299 #else 300 { 301 return _vcscanf_l(_Format, NULL, _ArgList); 302 } 303 #endif 304 305 _Check_return_opt_ 306 _CRT_STDIO_INLINE int __CRTDECL _vcscanf_s_l( 307 _In_z_ _Scanf_format_string_params_(2) char const* const _Format, 308 _In_opt_ _locale_t const _Locale, 309 va_list _ArgList 310 ) 311 #if defined _NO_CRT_STDIO_INLINE 312 ; 313 #else 314 { 315 return __conio_common_vcscanf( 316 _CRT_INTERNAL_LOCAL_SCANF_OPTIONS | _CRT_INTERNAL_SCANF_SECURECRT, 317 _Format, _Locale, _ArgList); 318 } 319 #endif 320 321 _Check_return_opt_ 322 _CRT_STDIO_INLINE int __CRTDECL _vcscanf_s( 323 _In_z_ _Scanf_format_string_params_(1) char const* const _Format, 324 va_list _ArgList 325 ) 326 #if defined _NO_CRT_STDIO_INLINE 327 ; 328 #else 329 { 330 return _vcscanf_s_l(_Format, NULL, _ArgList); 331 } 332 #endif 333 334 _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_cscanf_s_l) 335 _CRT_STDIO_INLINE int __CRTDECL _cscanf_l( 336 _In_z_ _Scanf_format_string_params_(0) char const* const _Format, 337 _In_opt_ _locale_t const _Locale, 338 ...) 339 #if defined _NO_CRT_STDIO_INLINE 340 ; 341 #else 342 { 343 int _Result; 344 va_list _ArgList; 345 __crt_va_start(_ArgList, _Locale); 346 347 _Result = _vcscanf_l(_Format, _Locale, _ArgList); 348 349 __crt_va_end(_ArgList); 350 return _Result; 351 } 352 #endif 353 354 _Check_return_opt_ _CRT_INSECURE_DEPRECATE(_cscanf_s) 355 _CRT_STDIO_INLINE int __CRTDECL _cscanf( 356 _In_z_ _Scanf_format_string_ char const* const _Format, 357 ...) 358 #if defined _NO_CRT_STDIO_INLINE 359 ; 360 #else 361 { 362 int _Result; 363 va_list _ArgList; 364 __crt_va_start(_ArgList, _Format); 365 366 _Result = _vcscanf_l(_Format, NULL, _ArgList); 367 368 __crt_va_end(_ArgList); 369 return _Result; 370 } 371 #endif 372 373 _Check_return_opt_ 374 _CRT_STDIO_INLINE int __CRTDECL _cscanf_s_l( 375 _In_z_ _Scanf_format_string_params_(0) char const* const _Format, 376 _In_opt_ _locale_t const _Locale, 377 ...) 378 #if defined _NO_CRT_STDIO_INLINE 379 ; 380 #else 381 { 382 int _Result; 383 va_list _ArgList; 384 __crt_va_start(_ArgList, _Locale); 385 _Result = _vcscanf_s_l(_Format, _Locale, _ArgList); 386 __crt_va_end(_ArgList); 387 return _Result; 388 } 389 #endif 390 391 _Check_return_opt_ 392 _CRT_STDIO_INLINE int __CRTDECL _cscanf_s( 393 _In_z_ _Scanf_format_string_ char const* const _Format, 394 ...) 395 #if defined _NO_CRT_STDIO_INLINE 396 ; 397 #else 398 { 399 int _Result; 400 va_list _ArgList; 401 __crt_va_start(_ArgList, _Format); 402 _Result = _vcscanf_s_l(_Format, NULL, _ArgList); 403 __crt_va_end(_ArgList); 404 return _Result; 405 } 406 #endif 407 408 409 _DCRTIMP int __cdecl _kbhit(void); 410 411 _Check_return_ _DCRTIMP int __cdecl _getch(void); 412 _Check_return_ _DCRTIMP int __cdecl _getche(void); 413 _Check_return_opt_ _DCRTIMP int __cdecl _putch (_In_ int _Ch); 414 _Check_return_opt_ _DCRTIMP int __cdecl _ungetch(_In_ int _Ch); 415 416 _Check_return_ _DCRTIMP int __cdecl _getch_nolock (void); 417 _Check_return_ _DCRTIMP int __cdecl _getche_nolock (void); 418 _Check_return_opt_ _DCRTIMP int __cdecl _putch_nolock (_In_ int _Ch); 419 _Check_return_opt_ _DCRTIMP int __cdecl _ungetch_nolock(_In_ int _Ch); 420 421 #if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES 422 423 // Suppress double-deprecation warnings: 424 #pragma warning(push) 425 #pragma warning(disable: 4141) 426 427 _Success_(return != 0) 428 _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_cgets) _CRT_INSECURE_DEPRECATE(_cgets_s) 429 _DCRTIMP char* __cdecl cgets( 430 _At_(&_Buffer[0], _In_reads_(1)) 431 _At_(&_Buffer[1], _Out_writes_(1)) 432 _At_(&_Buffer[2], _Post_z_ _Out_writes_to_(_Buffer[0], _Buffer[1])) 433 char* _Buffer 434 ); 435 436 #pragma warning(pop) 437 438 _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_cputs) 439 _DCRTIMP int __cdecl cputs( 440 _In_z_ char const* _String 441 ); 442 443 _Check_return_ _CRT_NONSTDC_DEPRECATE(_getch) 444 _DCRTIMP int __cdecl getch(void); 445 446 _Check_return_ _CRT_NONSTDC_DEPRECATE(_getche) 447 _DCRTIMP int __cdecl getche(void); 448 449 _Check_return_ _CRT_NONSTDC_DEPRECATE(_kbhit) 450 _DCRTIMP int __cdecl kbhit(void); 451 452 _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_putch) 453 _DCRTIMP int __cdecl putch( 454 _In_ int _Ch 455 ); 456 457 _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_ungetch) 458 _DCRTIMP int __cdecl ungetch( 459 _In_ int _Ch 460 ); 461 462 _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_cprintf) 463 _CRT_STDIO_INLINE int __CRTDECL cprintf( 464 _In_z_ _Printf_format_string_ char const* const _Format, 465 ...) 466 #if defined _NO_CRT_STDIO_INLINE 467 ; 468 #else 469 { 470 int _Result; 471 va_list _ArgList; 472 __crt_va_start(_ArgList, _Format); 473 _Result = _vcprintf_l(_Format, NULL, _ArgList); 474 __crt_va_end(_ArgList); 475 return _Result; 476 } 477 #endif 478 479 _Check_return_opt_ _CRT_NONSTDC_DEPRECATE(_cscanf) 480 _CRT_STDIO_INLINE int __CRTDECL cscanf( 481 _In_z_ _Scanf_format_string_ char const* const _Format, 482 ...) 483 #if defined _NO_CRT_STDIO_INLINE 484 ; 485 #else 486 { 487 int _Result; 488 va_list _ArgList; 489 __crt_va_start(_ArgList, _Format); 490 491 _Result = _vcscanf_l(_Format, NULL, _ArgList); 492 493 __crt_va_end(_ArgList); 494 return _Result; 495 } 496 #endif 497 498 #endif // _CRT_INTERNAL_NONSTDC_NAMES 499 500 _CRT_END_C_HEADER 501 502 _UCRT_RESTORE_CLANG_WARNINGS 503 #pragma warning(pop) // _UCRT_DISABLED_WARNINGS 504 #endif // _INC_CONIO 505