Security-Enhanced Versions of CRT Functions
More secure versions of run-time library routines are available. For further information concerning Security Enhancements in the CRT, see Security Features in the CRT.
Secure Functions
Function | Use | .NET Framework equivalent |
|---|---|---|
Determine file-access permission | Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples. | |
Allocates memory on the stack | Not applicable | |
Convert time from type struct tm to character string | System::DateTime::ToLongDateString, System::DateTime::ToLongTimeString, System::DateTime::ToShortDateString, System::DateTime::ToShortTimeString, System::DateTime::ToString | |
Performs a binary search of a sorted array | ||
Get a character string from the console | Not applicable | |
Changes the size of a file | System::IO::Stream::SetLength¸ System::IO::FileStream::SetLength | |
Resets the error indicator for a stream | Not applicable | |
Get and set the floating-point control word | Not applicable | |
Formats and prints to the console | Not applicable | |
Reads formatted data from the console | Not applicable | |
_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 | System::DateTime::GetDateTimeFormats, System::DateTime::ToString, System::DateTime::ToLongTimeString, System::DateTime::ToShortTimeString |
Converts a double number to a string | ||
Converts a floating-point number to a string | ||
Open a file | System::IO::File::Open, System::IO::FileStream::FileStream | |
Print formatted data to a stream | ||
Reassign a file pointer | System::IO::File::Open, System::IO::FileStream::FileStream | |
Read formatted data from a stream | System::IO::StreamReader::ReadLine. See also Parse methods, such as System::Double::Parse | |
Get the current time | ||
Converts a floating-point value to a string, which it stores in a buffer | ||
Get a value from the current environment. | ||
Get a line from the stdin stream | ||
Convert time from type time_t to structtm or from type __time64_t to struct tm | ||
_itoa_s, _i64toa_s, _ui64toa_s, _itow_s, _i64tow_s, _ui64tow_s | Convert an integer to a string | |
Performs a linear search for the specified key | ||
Convert time from type time_t to struct tm or from type __time64_t to struct tmwith local correction | ||
Performs a linear search for a value; adds to end of list if not found | Not applicable | |
Convert a long integer to a string | ||
Create a path name from components | ||
Copies a multibyte character from one string to another string | Not applicable | |
Appends, at most, the first n bytes of one multibyte character string to another | Not applicable | |
Copies n bytes of a string to a destination string | Not applicable | |
Converts a multibyte character string to a corresponding wide characters string | Not applicable | |
Converts a sequence of multibyte characters to a corresponding sequence of wide characters | Not applicable | |
Copies characters between buffers | Not applicable | |
Moves one buffer to another | Not applicable | |
Create a unique filename | Not applicable | |
Print formatted output to the standard output stream | ||
Create, modify, or remove environment variables | Not applicable | |
Performs a quick sort | ||
Generates a pseudorandom number | ||
Read formatted data from the standard input stream | System::Console::Read, System::Console::ReadLine, see also Parse methods, such as System::Double::Parse | |
Search for a file using environment paths | Not applicable | |
Write formatted data to a string | Not applicable | |
Read formatted data of a specified length from a string. | Not applicable | |
Open a file for sharing | Not applicable | |
Break a path name into components | Not applicable | |
Write formatted data to a string | ||
Read formatted data from a string | See Parse methods, such as System::Double::Parse | |
Append a string | ||
Copy a string | ||
Return current system date as string | ||
Get a system error message (strerror, _wcserror) or prints a user-supplied error message (_strerror, __wcserror) | ||
_strlwr_s, _strlwr_s_l, _mbslwr_s, _mbslwr_s_l, _wcslwr_s, _wcslwr_s_l | Convert a string to lowercase | |
strncat_s, _strncat_s_l, wcsncat_s, _wcsncat_s_l, _mbsncat_s, _mbsncat_s_l | Append characters to a string | |
strncpy_s, _strncpy_s_l, wcsncpy_s, _wcsncpy_s_l, _mbsncpy_s, _mbsncpy_s_l | Copy characters of one string to another | |
Return current system time as string | System::DateTime::ToLongDateString, System::DateTime::ToLongTimeString, System::DateTime::ToShortDateString, System::DateTime::ToShortTimeString, System::DateTime::ToString | |
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 | Not applicable |
_strupr_s, _strupr_s_l, _mbsupr_s, _mbsupr_s_l, _wcsupr_s, _wcsupr_s_l | Convert a string to uppercase | |
Creates a temporary file | Not applicable | |
Generate names you can use to create temporary files | Not applicable | |
Convert an unsigned long integer to a string | ||
Sets the default file-permission mask | ||
Write formatted output to the console using a pointer to a list of arguments | ||
Write formatted output using a pointer to a list of arguments | Not applicable | |
Write formatted output using a pointer to a list of arguments | ||
vsnprintf_s, _vsnprintf_s, _vsnprintf_s_l, _vsnwprintf_s, _vsnwprintf_s_l | Write formatted output using a pointer to a list of arguments | Not applicable |
Write formatted output using a pointer to a list of arguments | ||
Convert a wide character into its multibyte character representation | Not applicable | |
Convert a wide character string to its multibyte character string representation | Not applicable | |
Converts a sequence of wide characters to a corresponding sequence of multibyte characters | Not applicable | |
Converts a wide character to the corresponding multibyte character | Not applicable |