1 // 2 // corecrt_wstdlib.h 3 // 4 // Copyright (c) Microsoft Corporation. All rights reserved. 5 // 6 // This file declares the wide character (wchar_t) C Standard Library functions 7 // that are declared by both <stdlib.h> and <wchar.h>. 8 // 9 #pragma once 10 11 #include <corecrt.h> 12 13 #pragma warning(push) 14 #pragma warning(disable: _UCRT_DISABLED_WARNINGS) 15 _UCRT_DISABLE_CLANG_WARNINGS 16 17 _CRT_BEGIN_C_HEADER 18 19 20 21 // Maximum number of elements, including null terminator (and negative sign 22 // where appropriate), needed for integer-to-string conversions for several 23 // bases and integer types. 24 #define _MAX_ITOSTR_BASE16_COUNT (8 + 1) 25 #define _MAX_ITOSTR_BASE10_COUNT (1 + 10 + 1) 26 #define _MAX_ITOSTR_BASE8_COUNT (11 + 1) 27 #define _MAX_ITOSTR_BASE2_COUNT (32 + 1) 28 29 #define _MAX_LTOSTR_BASE16_COUNT (8 + 1) 30 #define _MAX_LTOSTR_BASE10_COUNT (1 + 10 + 1) 31 #define _MAX_LTOSTR_BASE8_COUNT (11 + 1) 32 #define _MAX_LTOSTR_BASE2_COUNT (32 + 1) 33 34 #define _MAX_ULTOSTR_BASE16_COUNT (8 + 1) 35 #define _MAX_ULTOSTR_BASE10_COUNT (10 + 1) 36 #define _MAX_ULTOSTR_BASE8_COUNT (11 + 1) 37 #define _MAX_ULTOSTR_BASE2_COUNT (32 + 1) 38 39 #define _MAX_I64TOSTR_BASE16_COUNT (16 + 1) 40 #define _MAX_I64TOSTR_BASE10_COUNT (1 + 19 + 1) 41 #define _MAX_I64TOSTR_BASE8_COUNT (22 + 1) 42 #define _MAX_I64TOSTR_BASE2_COUNT (64 + 1) 43 44 #define _MAX_U64TOSTR_BASE16_COUNT (16 + 1) 45 #define _MAX_U64TOSTR_BASE10_COUNT (20 + 1) 46 #define _MAX_U64TOSTR_BASE8_COUNT (22 + 1) 47 #define _MAX_U64TOSTR_BASE2_COUNT (64 + 1) 48 49 50 #if _CRT_FUNCTIONS_REQUIRED 51 52 _Success_(return == 0) 53 _Check_return_wat_ 54 _ACRTIMP errno_t __cdecl _itow_s( 55 _In_ int _Value, 56 _Out_writes_z_(_BufferCount) wchar_t* _Buffer, 57 _In_ size_t _BufferCount, 58 _In_ int _Radix 59 ); 60 61 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1( 62 errno_t, _itow_s, 63 _In_ int, _Value, 64 wchar_t, _Buffer, 65 _In_ int, _Radix 66 ) 67 68 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1( 69 wchar_t*, __RETURN_POLICY_DST, _ACRTIMP, _itow, 70 _In_ int, _Value, 71 _Pre_notnull_ _Post_z_, wchar_t, _Buffer, 72 _In_ int, _Radix 73 ) 74 75 _Success_(return == 0) 76 _Check_return_wat_ 77 _ACRTIMP errno_t __cdecl _ltow_s( 78 _In_ long _Value, 79 _Out_writes_z_(_BufferCount) wchar_t* _Buffer, 80 _In_ size_t _BufferCount, 81 _In_ int _Radix 82 ); 83 84 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1( 85 errno_t, _ltow_s, 86 _In_ long, _Value, 87 wchar_t, _Buffer, 88 _In_ int, _Radix 89 ) 90 91 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1( 92 wchar_t*, __RETURN_POLICY_DST, _ACRTIMP, _ltow, 93 _In_ long, _Value, 94 _Pre_notnull_ _Post_z_, wchar_t, _Buffer, 95 _In_ int, _Radix 96 ) 97 98 _Check_return_wat_ 99 _ACRTIMP errno_t __cdecl _ultow_s( 100 _In_ unsigned long _Value, 101 _Out_writes_z_(_BufferCount) wchar_t* _Buffer, 102 _In_ size_t _BufferCount, 103 _In_ int _Radix 104 ); 105 106 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1( 107 errno_t, _ultow_s, 108 _In_ unsigned long, _Value, 109 wchar_t, _Buffer, 110 _In_ int, _Radix 111 ) 112 113 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1( 114 wchar_t*, __RETURN_POLICY_DST, _ACRTIMP, _ultow, 115 _In_ unsigned long, _Value, 116 _Pre_notnull_ _Post_z_, wchar_t, _Buffer, 117 _In_ int, _Radix 118 ) 119 120 _Check_return_ 121 _ACRTIMP double __cdecl wcstod( 122 _In_z_ wchar_t const* _String, 123 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr 124 ); 125 126 _Check_return_ 127 _ACRTIMP double __cdecl _wcstod_l( 128 _In_z_ wchar_t const* _String, 129 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 130 _In_opt_ _locale_t _Locale 131 ); 132 133 _Check_return_ 134 _ACRTIMP long __cdecl wcstol( 135 _In_z_ wchar_t const* _String, 136 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 137 _In_ int _Radix 138 ); 139 140 _Check_return_ 141 _ACRTIMP long __cdecl _wcstol_l( 142 _In_z_ wchar_t const* _String, 143 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 144 _In_ int _Radix, 145 _In_opt_ _locale_t _Locale 146 ); 147 148 _Check_return_ 149 _ACRTIMP long long __cdecl wcstoll( 150 _In_z_ wchar_t const* _String, 151 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 152 _In_ int _Radix 153 ); 154 155 _Check_return_ 156 _ACRTIMP long long __cdecl _wcstoll_l( 157 _In_z_ wchar_t const* _String, 158 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 159 _In_ int _Radix, 160 _In_opt_ _locale_t _Locale 161 ); 162 163 _Check_return_ 164 _ACRTIMP unsigned long __cdecl wcstoul( 165 _In_z_ wchar_t const* _String, 166 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 167 _In_ int _Radix 168 ); 169 170 _Check_return_ 171 _ACRTIMP unsigned long __cdecl _wcstoul_l( 172 _In_z_ wchar_t const* _String, 173 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 174 _In_ int _Radix, 175 _In_opt_ _locale_t _Locale 176 ); 177 178 _Check_return_ 179 _ACRTIMP unsigned long long __cdecl wcstoull( 180 _In_z_ wchar_t const* _String, 181 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 182 _In_ int _Radix 183 ); 184 185 _Check_return_ 186 _ACRTIMP unsigned long long __cdecl _wcstoull_l( 187 _In_z_ wchar_t const* _String, 188 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 189 _In_ int _Radix, 190 _In_opt_ _locale_t _Locale 191 ); 192 193 _Check_return_ 194 _ACRTIMP long double __cdecl wcstold( 195 _In_z_ wchar_t const* _String, 196 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr 197 ); 198 199 _Check_return_ 200 _ACRTIMP long double __cdecl _wcstold_l( 201 _In_z_ wchar_t const* _String, 202 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 203 _In_opt_ _locale_t _Locale 204 ); 205 206 _Check_return_ 207 _ACRTIMP float __cdecl wcstof( 208 _In_z_ wchar_t const* _String, 209 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr 210 ); 211 212 _Check_return_ 213 _ACRTIMP float __cdecl _wcstof_l( 214 _In_z_ wchar_t const* _String, 215 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 216 _In_opt_ _locale_t _Locale 217 ); 218 219 _Check_return_ 220 _ACRTIMP double __cdecl _wtof( 221 _In_z_ wchar_t const* _String 222 ); 223 224 _Check_return_ 225 _ACRTIMP double __cdecl _wtof_l( 226 _In_z_ wchar_t const* _String, 227 _In_opt_ _locale_t _Locale 228 ); 229 230 _Check_return_ 231 _ACRTIMP int __cdecl _wtoi( 232 _In_z_ wchar_t const* _String 233 ); 234 235 _Check_return_ 236 _ACRTIMP int __cdecl _wtoi_l( 237 _In_z_ wchar_t const* _String, 238 _In_opt_ _locale_t _Locale 239 ); 240 241 _Check_return_ 242 _ACRTIMP long __cdecl _wtol( 243 _In_z_ wchar_t const* _String 244 ); 245 246 _Check_return_ 247 _ACRTIMP long __cdecl _wtol_l( 248 _In_z_ wchar_t const* _String, 249 _In_opt_ _locale_t _Locale 250 ); 251 252 _Check_return_ 253 _ACRTIMP long long __cdecl _wtoll( 254 _In_z_ wchar_t const* _String 255 ); 256 257 _Check_return_ 258 _ACRTIMP long long __cdecl _wtoll_l( 259 _In_z_ wchar_t const* _String, 260 _In_opt_ _locale_t _Locale 261 ); 262 263 _Check_return_wat_ 264 _ACRTIMP errno_t __cdecl _i64tow_s( 265 _In_ __int64 _Value, 266 _Out_writes_z_(_BufferCount) wchar_t* _Buffer, 267 _In_ size_t _BufferCount, 268 _In_ int _Radix 269 ); 270 271 _CRT_INSECURE_DEPRECATE(_i64tow_s) 272 _ACRTIMP wchar_t* __cdecl _i64tow( 273 _In_ __int64 _Value, 274 _Pre_notnull_ _Post_z_ wchar_t* _Buffer, 275 _In_ int _Radix 276 ); 277 278 _Check_return_wat_ 279 _ACRTIMP errno_t __cdecl _ui64tow_s( 280 _In_ unsigned __int64 _Value, 281 _Out_writes_z_(_BufferCount) wchar_t* _Buffer, 282 _In_ size_t _BufferCount, 283 _In_ int _Radix 284 ); 285 286 _CRT_INSECURE_DEPRECATE(_ui64tow_s) 287 _ACRTIMP wchar_t* __cdecl _ui64tow( 288 _In_ unsigned __int64 _Value, 289 _Pre_notnull_ _Post_z_ wchar_t* _Buffer, 290 _In_ int _Radix 291 ); 292 293 _Check_return_ 294 _ACRTIMP __int64 __cdecl _wtoi64( 295 _In_z_ wchar_t const* _String 296 ); 297 298 _Check_return_ 299 _ACRTIMP __int64 __cdecl _wtoi64_l( 300 _In_z_ wchar_t const* _String, 301 _In_opt_ _locale_t _Locale 302 ); 303 304 _Check_return_ 305 _ACRTIMP __int64 __cdecl _wcstoi64( 306 _In_z_ wchar_t const* _String, 307 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 308 _In_ int _Radix 309 ); 310 311 _Check_return_ 312 _ACRTIMP __int64 __cdecl _wcstoi64_l( 313 _In_z_ wchar_t const* _String, 314 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 315 _In_ int _Radix, 316 _In_opt_ _locale_t _Locale 317 ); 318 319 _Check_return_ 320 _ACRTIMP unsigned __int64 __cdecl _wcstoui64( 321 _In_z_ wchar_t const* _String, 322 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 323 _In_ int _Radix 324 ); 325 326 _Check_return_ 327 _ACRTIMP unsigned __int64 __cdecl _wcstoui64_l( 328 _In_z_ wchar_t const* _String, 329 _Out_opt_ _Deref_post_z_ wchar_t** _EndPtr, 330 _In_ int _Radix, 331 _In_opt_ _locale_t _Locale 332 ); 333 334 #pragma push_macro("_wfullpath") 335 #undef _wfullpath 336 337 _Success_(return != 0) 338 _Check_return_ 339 _ACRTIMP _CRTALLOCATOR wchar_t* __cdecl _wfullpath( 340 _Out_writes_opt_z_(_BufferCount) wchar_t* _Buffer, 341 _In_z_ wchar_t const* _Path, 342 _In_ size_t _BufferCount 343 ); 344 345 #pragma pop_macro("_wfullpath") 346 347 _Check_return_wat_ 348 _ACRTIMP errno_t __cdecl _wmakepath_s( 349 _Out_writes_z_(_BufferCount) wchar_t* _Buffer, 350 _In_ size_t _BufferCount, 351 _In_opt_z_ wchar_t const* _Drive, 352 _In_opt_z_ wchar_t const* _Dir, 353 _In_opt_z_ wchar_t const* _Filename, 354 _In_opt_z_ wchar_t const* _Ext 355 ); 356 357 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_4( 358 errno_t, _wmakepath_s, 359 wchar_t, _Buffer, 360 _In_opt_z_ wchar_t const*, _Drive, 361 _In_opt_z_ wchar_t const*, _Dir, 362 _In_opt_z_ wchar_t const*, _Filename, 363 _In_opt_z_ wchar_t const*, _Ext 364 ) 365 366 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_4( 367 void, __RETURN_POLICY_VOID, _ACRTIMP, _wmakepath, 368 _Pre_notnull_ _Post_z_, wchar_t, _Buffer, 369 _In_opt_z_ wchar_t const*, _Drive, 370 _In_opt_z_ wchar_t const*, _Dir, 371 _In_opt_z_ wchar_t const*, _Filename, 372 _In_opt_z_ wchar_t const*, _Ext 373 ) 374 375 _ACRTIMP void __cdecl _wperror( 376 _In_opt_z_ wchar_t const* _ErrorMessage 377 ); 378 379 _CRT_INSECURE_DEPRECATE(_wsplitpath_s) 380 _ACRTIMP void __cdecl _wsplitpath( 381 _In_z_ wchar_t const* _FullPath, 382 _Pre_maybenull_ _Post_z_ wchar_t* _Drive, 383 _Pre_maybenull_ _Post_z_ wchar_t* _Dir, 384 _Pre_maybenull_ _Post_z_ wchar_t* _Filename, 385 _Pre_maybenull_ _Post_z_ wchar_t* _Ext 386 ); 387 388 _ACRTIMP errno_t __cdecl _wsplitpath_s( 389 _In_z_ wchar_t const* _FullPath, 390 _Out_writes_opt_z_(_DriveCount) wchar_t* _Drive, 391 _In_ size_t _DriveCount, 392 _Out_writes_opt_z_(_DirCount) wchar_t* _Dir, 393 _In_ size_t _DirCount, 394 _Out_writes_opt_z_(_FilenameCount) wchar_t* _Filename, 395 _In_ size_t _FilenameCount, 396 _Out_writes_opt_z_(_ExtCount) wchar_t* _Ext, 397 _In_ size_t _ExtCount 398 ); 399 400 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_SPLITPATH( 401 errno_t, _wsplitpath_s, 402 wchar_t, _Path 403 ) 404 405 #pragma push_macro("_wdupenv_s") 406 #undef _wdupenv_s 407 408 _Check_return_wat_ 409 _DCRTIMP errno_t __cdecl _wdupenv_s( 410 _Outptr_result_buffer_maybenull_(*_BufferCount) _Outptr_result_maybenull_z_ wchar_t** _Buffer, 411 _Out_opt_ size_t* _BufferCount, 412 _In_z_ wchar_t const* _VarName 413 ); 414 415 #pragma pop_macro("_wdupenv_s") 416 417 _Check_return_ _CRT_INSECURE_DEPRECATE(_wdupenv_s) 418 _DCRTIMP wchar_t* __cdecl _wgetenv( 419 _In_z_ wchar_t const* _VarName 420 ); 421 422 _Success_(return == 0) 423 _Check_return_wat_ 424 _DCRTIMP errno_t __cdecl _wgetenv_s( 425 _Out_ size_t* _RequiredCount, 426 _Out_writes_opt_z_(_BufferCount) wchar_t* _Buffer, 427 _In_ size_t _BufferCount, 428 _In_z_ wchar_t const* _VarName 429 ); 430 431 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1( 432 _Success_(return == 0) 433 errno_t, _wgetenv_s, 434 _Out_ size_t*, _RequiredCount, 435 wchar_t, _Buffer, 436 _In_z_ wchar_t const*, _VarName 437 ) 438 439 _Check_return_ 440 _DCRTIMP int __cdecl _wputenv( 441 _In_z_ wchar_t const* _EnvString 442 ); 443 444 _Check_return_wat_ 445 _DCRTIMP errno_t __cdecl _wputenv_s( 446 _In_z_ wchar_t const* _Name, 447 _In_z_ wchar_t const* _Value 448 ); 449 450 _DCRTIMP errno_t __cdecl _wsearchenv_s( 451 _In_z_ wchar_t const* _Filename, 452 _In_z_ wchar_t const* _VarName, 453 _Out_writes_z_(_BufferCount) wchar_t* _Buffer, 454 _In_ size_t _BufferCount 455 ); 456 457 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_2_0( 458 errno_t, _wsearchenv_s, 459 _In_z_ wchar_t const*, _Filename, 460 _In_z_ wchar_t const*, _VarName, 461 wchar_t, _ResultPath 462 ) 463 464 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_2_0( 465 void, __RETURN_POLICY_VOID, _DCRTIMP, _wsearchenv, 466 _In_z_ wchar_t const*, _Filename, 467 _In_z_ wchar_t const*, _VarName, 468 _Pre_notnull_ _Post_z_, wchar_t, _ResultPath 469 ) 470 471 _DCRTIMP int __cdecl _wsystem( 472 _In_opt_z_ wchar_t const* _Command 473 ); 474 475 #endif // _CRT_FUNCTIONS_REQUIRED 476 477 478 479 _CRT_END_C_HEADER 480 _UCRT_RESTORE_CLANG_WARNINGS 481 #pragma warning(pop) // _UCRT_DISABLED_WARNINGS 482