Muokkaa

Jaa


Security-enhanced versions of CRT functions

More secure versions of run-time library routines are available. For more information about security enhancements in the CRT, see Security features in the CRT.

Secure functions

CRT Function Security enhanced function Use
_access, _waccess _access_s, _waccess_s Determine file-access permission
_alloca _malloca Allocate memory on the stack
asctime, _wasctime asctime_s, _wasctime_s Convert time from type struct tm to character string
bsearch bsearch_s Perform a binary search of a sorted array
_cgets, _cgetws _cgets_s, _cgetws_s Get a character string from the console
_chsize _chsize_s Change the size of a file
clearerr clearerr_s Reset the error indicator for a stream
_control87, _controlfp, __control87_2 _controlfp_s Get and set the floating-point control word
_cprintf, _cprintf_l, _cwprintf, _cwprintf_l _cprintf_s, _cprintf_s_l, _cwprintf_s, _cwprintf_s_l Format and print to the console
_cscanf, _cscanf_l, _cwscanf, _cwscanf_l _cscanf_s, _cscanf_s_l, _cwscanf_s, _cwscanf_s_l Read formatted data from the console
ctime, _ctime32, _ctime64, _wctime, _wctime32, _wctime64 _ctime_s, _ctime32_s, _ctime64_s, _wctime_s, _wctime32_s, _wctime64_s Convert time from type time_t, __time32_t or __time64_t to character string
_ecvt _ecvt_s Convert a double number to a string
_fcvt _fcvt_s Converts a floating-point number to a string
fopen, _wfopen fopen_s, _wfopen_s Open a file
fprintf, _fprintf_l, fwprintf, _fwprintf_l fprintf_s, _fprintf_s_l, fwprintf_s, _fwprintf_s_l Print formatted data to a stream
fread fread_s Read from a file
_fread_nolock _fread_nolock_s Read from a file without using a multi-thread write lock
freopen, _wfreopen freopen_s, _wfreopen_s Reopen the file
fscanf, _fscanf_l, fwscanf, _fwscanf_l fscanf_s, _fscanf_s_l, fwscanf_s, _fwscanf_s_l Read formatted data from a stream
_ftime, _ftime32, _ftime64 _ftime_s, _ftime32_s, _ftime64_s Get the current time
_gcvt _gcvt_s Convert a floating-point value to a string, and store it in a buffer
getenv, _wgetenv getenv_s, _wgetenv_s Get a value from the current environment.
gets, getws gets_s, _getws_s Get a line from the stdin stream
gmtime, _gmtime32, _gmtime64 _gmtime32_s, _gmtime64_s Convert time from type time_t to struct tm or from type __time64_t to struct tm
itoa, _itoa, ltoa, _ltoa, ultoa, _ultoa, _i64toa, _ui64toa, _itow, _ltow, _ultow, _i64tow, _ui64tow _itoa_s, _ltoa_s, _ultoa_s, _i64toa_s, _ui64toa_s, _itow_s, _ltow_s, _ultow_s, _i64tow_s, _ui64tow_s Convert an integral type to a string
_lfind _lfind_s Perform a linear search for the specified key
localtime, _localtime32, _localtime64 localtime_s, _localtime32_s, _localtime64_s Convert time from type time_t to struct tm or from type __time64_t to struct tm with local correction
_lsearch _lsearch_s Perform a linear search for a value; adds to end of list if not found
_makepath, _wmakepath _makepath_s, _wmakepath_s Create a path name from components
_mbccpy, _mbccpy_l _mbccpy_s, _mbccpy_s_l Copy a multibyte character from one string to another string
_mbsnbcat, _mbsnbcat_l _mbsnbcat_s, _mbsnbcat_s_l Append at most the first n bytes of one multibyte character string to another
_mbsnbcpy, _mbsnbcpy_l _mbsnbcpy_s, _mbsnbcpy_s_l Copy n bytes of a string to a destination string
_mbsnbset, _mbsnbset_l _mbsnbset_s, _mbsnbset_s_l Set the first n bytes of a string to a specified character
mbsrtowcs mbsrtowcs_s Convert a multibyte character string to a corresponding wide character string
mbstowcs, _mbstowcs_l mbstowcs_s, _mbstowcs_s_l Convert a sequence of multibyte characters to a corresponding sequence of wide characters
memcpy, wmemcpy memcpy_s, wmemcpy_s Copy characters between buffers
memmove, wmemmove memmove_s, wmemmove_s Move one buffer to another
_mktemp, _wmktemp _mktemp_s, _wmktemp_s Create a unique filename
printf, _printf_l, wprintf, _wprintf_l printf_s, _printf_s_l, wprintf_s, _wprintf_s_l Print formatted output to the standard output stream
_putenv, _wputenv _putenv_s, _wputenv_s Create, modify, or remove environment variables
qsort qsort_s Perform a quick sort
rand rand_s Generate a pseudorandom number
scanf, _scanf_l, wscanf, _wscanf_l scanf_s, _scanf_s_l, wscanf_s, _wscanf_s_l Read formatted data from the standard input stream
_searchenv, _wsearchenv _searchenv_s, _wsearchenv_s Search for a file using environment paths
snprintf, _snprintf, _snprintf_l, _snwprintf, _snwprintf_l _snprintf_s, _snprintf_s_l, _snwprintf_s, _snwprintf_s_l Write formatted data to a string
_snscanf, _snscanf_l, _snwscanf, _snwscanf_l _snscanf_s, _snscanf_s_l, _snwscanf_s, _snwscanf_s_l Read formatted data of a specified length from a string.
_sopen, _wsopen _sopen_s, _wsopen_s Open a file for sharing
_splitpath, _wsplitpath _splitpath_s, _wsplitpath_s Break a path name into components
sprintf, _sprintf_l, swprintf, _swprintf_l, __swprintf_l sprintf_s, _sprintf_s_l, swprintf_s, _swprintf_s_l Write formatted data to a string
sscanf, _sscanf_l, swscanf, _swscanf_l sscanf_s, _sscanf_s_l, swscanf_s, _swscanf_s_l Read formatted data from a string
strcat, wcscat, _mbscat strcat_s, wcscat_s, _mbscat_s Append a string
strcpy, wcscpy, _mbscpy strcpy_s, wcscpy_s, _mbscpy_s Copy a string
_strdate, _wstrdate _strdate_s, _wstrdate_s Return current system date as string
strerror, _strerror, _wcserror, __wcserror strerror_s, _strerror_s, _wcserror_s, __wcserror_s Get a system error message (strerror, _wcserror) or print a user-supplied error message (_strerror, __wcserror)
_strlwr, _wcslwr, _mbslwr, _strlwr_l, _wcslwr_l, _mbslwr_l _strlwr_s, _strlwr_s_l, _mbslwr_s, _mbslwr_s_l, _wcslwr_s, _wcslwr_s_l Convert a string to lowercase
strncat, _strncat_l, wcsncat, _wcsncat_l, _mbsncat, _mbsncat_l strncat_s, _strncat_s_l, wcsncat_s, _wcsncat_s_l, _mbsncat_s, _mbsncat_s_l Append characters to a string
strncpy, _strncpy_l, wcsncpy, _wcsncpy_l, _mbsncpy, _mbsncpy_l strncpy_s, _strncpy_s_l, wcsncpy_s, _wcsncpy_s_l, _mbsncpy_s, _mbsncpy_s_l Copy characters of one string to another
_strnset, _strnset_l, _wcsnset, _wcsnset_l, _mbsnset, _mbsnset_l _strnset_s, _strnset_s_l, _wcsnset_s, _wcsnset_s_l, _mbsnset_s, _mbsnset_s_l Set the first n characters of a string to the specified character
_strset, _strset_l, _wcsset, _wcsset_l, _mbsset, _mbsset_l _strset_s, _strset_s_l, _wcsset_s, _wcsset_s_l, _mbsset_s, _mbsset_s_l Set all the characters of a string to the specified character
_strtime, _wstrtime _strtime_s, _wstrtime_s Return current system time as string
strtok, _strtok_l, wcstok, _wcstok_l, _mbstok, _mbstok_l strtok_s, _strtok_s_l, wcstok_s, _wcstok_s_l, _mbstok_s, _mbstok_s_l Find the next token in a string, using the current locale or a locale passed in
_strupr, _strupr_l, _mbsupr, _mbsupr_l, _wcsupr_l, _wcsupr _strupr_s, _strupr_s_l, _mbsupr_s, _mbsupr_s_l, _wcsupr_s, _wcsupr_s_l Convert a string to uppercase
tmpfile tmpfile_s Create a temporary file
_tempnam, _wtempnam, tmpnam, _wtmpnam tmpnam_s, _wtmpnam_s Generate names you can use to create temporary files
_umask _umask_s Set the default file-permission mask
_vcprintf, _vcprintf_l, _vcwprintf, _vcwprintf_l _vcprintf_s, _vcprintf_s_l, _vcwprintf_s, _vcwprintf_s_l Write formatted output to the console using a pointer to a list of arguments
vfprintf, _vfprintf_l, vfwprintf, _vfwprintf_l vfprintf_s, _vfprintf_s_l, vfwprintf_s, _vfwprintf_s_l Write formatted output using a pointer to a list of arguments
vfscanf, vfwscanf vfscanf_s, vfwscanf_s Read formatted data from a stream
vprintf, _vprintf_l, vwprintf, _vwprintf_l vprintf_s, _vprintf_s_l, vwprintf_s, _vwprintf_s_l Write formatted output using a pointer to a list of arguments
vscanf, vwscanf vscanf_s, vwscanf_s Read formatted data from the standard input stream
vsnprintf, _vsnprintf, _vsnprintf_l, _vsnwprintf, _vsnwprintf_l vsnprintf_s, _vsnprintf_s, _vsnprintf_s_l, _vsnwprintf_s, _vsnwprintf_s_l Write formatted output using a pointer to a list of arguments
vsprintf, _vsprintf_l, vswprintf, _vswprintf_l, __vswprintf_l vsprintf_s, _vsprintf_s_l, vswprintf_s, _vswprintf_s_l Write formatted output using a pointer to a list of arguments
vsscanf, vswscanf vsscanf_s, vswscanf_s Read formatted data from a string
wcrtomb wcrtomb_s Convert a wide character into its multibyte character representation
wcsrtombs wcsrtombs_s Convert a wide character string to its multibyte character string representation
wcstombs, _wcstombs_l wcstombs_s, _wcstombs_s_l Convert a sequence of wide characters to a corresponding sequence of multibyte characters
wctomb, _wctomb_l wctomb_s, _wctomb_s_l Convert a wide character to the corresponding multibyte character

See also

C runtime (CRT) and C++ Standard Library (STL) .lib files