Visual C++ 2010 CRT函数的安全性增强版本

Security-Enhanced Versions of CRT Functions
(CRT = C Runtime Library = C运行时间库)
 
为微软公司对C/C++语言的扩展,其中的一部分已于2003年提交给ISO作为C/C++标准下一版本的修改建议。
安全CRT函数,在原来函数名后添加了“_s”后缀;一般返回出错代码;并将原来的返回值,作为一个参数,添加到函数输入参数列表的最后;对带缓冲区参数的函数,还添加了表示缓冲区大小的输入参数,以防止溢出。
有关的帮助文档参见URL:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.chs/dv_vccrt/html/f87e5a01-4cb2-4379-9e8f-d4693828c55a.htm
1.类型定义
下面是若干安全函数原型用到的类型定义:
#include <crtdefs.h>
typedef int errno_t;
typedef unsigned short wchar_t;
#ifdef _WIN64
typedef unsigned __int64    size_t;
#else
typedef _W64 unsigned int   size_t;
#endif
2.常用安全CRT函数
下面是若干最常用的安全CRT函数原型:
(说明:红色部分为函数名;函数原型后面是其所在的头文件)
 

char *gets_s( char *buffer, size_t sizeInCharacters); // <stdio.h>

wchar_t *_getws_s( wchar_t *buffer, size_t sizeInCharacters); // <stdio.h> or <wchar.h>

 

errno_t _itoa_s( int value, char *buffer, size_t sizeInCharacters, int radix ); // <stdlib.h>

errno_t _itow_s( int value, wchar_t *buffer, size_t sizeInCharacters, int radix ); // <stdlib.h>

errno_t _ultoa_s( unsigned long value, char *str, size_t sizeOfstr, int radix ); // <stdlib.h>

errno_t _ultow_s( unsigned long value, wchar_t *str, size_t sizeOfstr, int radix ); // <stdlib.h>

 

int printf_s( const char *format [, argument]... ); // <stdio.h>

int wprintf_s( const wchar_t *format [, argument]... ); // <stdio.h> or <wchar.h>

int scanf_s( const char *format [, argument]... ); // <stdio.h>

int wscanf_s( const wchar_t *format [, argument]... ); // <stdio.h> or <wchar.h>

int sprintf_s( char *buffer, size_t sizeOfBuffer, const char *format [, argument] ... ); // <stdio.h>

int swprintf_s( wchar_t *buffer, size_t sizeOfBuffer, const wchar_t *format [, argument]...); // <stdio.h> or <wchar.h>

int sscanf_s( const char *buffer, const char *format [, argument ] ...); // <stdio.h>

int swscanf_s( const wchar_t *buffer, const wchar_t *format [, argument ] ...); // <stdio.h> or <wchar.h>

int fprintf_s( FILE *stream, const char *format [, argument ]...); // <stdio.h>

int fwscanf_s( FILE *stream, const wchar_t *format [, argument ]... ); // <stdio.h> or <wchar.h>

int fscanf_s( FILE *stream, const char *format [, argument ]... ); // <stdio.h>

int fwscanf_s( FILE *stream, const wchar_t *format [, argument ]... ); // <stdio.h> or <wchar.h>

 

errno_t strcpy_s( char *strDestination, size_t sizeInBytes, const char *strSource ); // <string.h>

errno_t wcscpy_s( wchar_t *strDestination, size_t sizeInWords, const wchar_t *strSource ); // <string.h> or <wchar.h>

 

errno_t fopen_s( FILE** pFile, const char *filename, const char *mode ); // <stdio.h>

errno_t _wfopen_s( FILE** pFile, const wchar_t *filename, const wchar_t *mode ); // <stdio.h> or <wchar.h>

 

errno_t mbstowcs_s( size_t *pConvertedChars, wchar_t *wcstr, size_t sizeInWords, const char *mbstr, size_t count ); // <stdlib.h>

errno_t wcstombs_s( size_t *pConvertedChars, char *mbstr, size_t sizeInBytes, const wchar_t *wcstr, size_t count ); // <stdlib.h>

 

errno_t rand_s( unsigned int* randomValue); // <stdlib.h>

3.全部安全CRT函数
下面按字母顺序(分组)列出全部安全CRT函数的原型:
(说明:彩色部分为函数名,红色为较为常用的,绿色为不太常用的;函数原型后面是其所在的头文件)

errno_t _access_s( const char *path, int mode ); // <io.h>

errno_t _waccess_s( const wchar_t *path, int mode ); // <io.h>

void *_malloca( size_t size ); // <malloc.h>

errno_t asctime_s( char* buffer, size_t sizeInBytes, const struct tm *_tm ); // <time.h>

errno_t _wasctime_s( wchar_t* buffer, size_t sizeInWords, const struct tm *_tm ); // <time.h>

template <size_t size> errno_t asctime_s( char (&buffer)[size], const struct tm *_tm ); // <time.h> C++ only

template <size_t size> errno_t _wasctime_s( wchar_t (&buffer)[size], const struct tm *_tm ); // <time.h> C++ only

void *bsearch_s( const void *key, const void *base, size_t num, size_t width, int ( __cdecl *compare ) ( void *, const void *, const void *), void * context); // <stdio.h>

errno_t _cgets_s( char *buffer, size_t sizeInBytes, size_t *pSizeRead); // <stdio.h>

errno_t _cgetws_s( wchar_t *buffer, size_t sizeInWords, size_t *pSizeRead); // <stdio.h> or <wchar.h>

template <size_t size> errno_t _cgets_s( char (&buffer)[size], size_t *pSizeRead); // <stdio.h> C++ only

template <size_t size> errno_t _cgetws_s( wchar_t (&buffer)[size], size_t *pSizeRead); // <stdio.h> or <wchar.h> C++ only

errno_t _chsize_s( int fd, __int64 size ); // <io.h>

errno_t clearerr_s( FILE *stream ); // <stdio.h>

errno_t _controlfp_s( unsigned int *currentControl, unsigned int newControl, unsigned int mask); // <float.h>

int _cprintf_s( const char * format [, argument] ... ); // <conio.h>

int _cprintf_s_l( const char * format, locale_t locale [, argument] ... ); // <conio.h>

int _cwprintf_s( const wchar * format [, argument] ...); // <conio.h> or <wchar.h>

int _cwprintf_s_l( const wchar * format, locale_t locale [, argument] ...); // <conio.h> or <wchar.h>

int _cscanf_s( const char *format [, argument] ... ); // <conio.h>

int _cscanf_s_l( const char *format, locale_t locale [, argument] ... ); // <conio.h>

int _cwscanf_s( const wchar_t *format [, argument] ... ); // <conio.h> or <wchar.h>

int _cwscanf_s_l( const wchar_t *format, locale_t locale [, argument] ... ); // <conio.h> or <wchar.h>

errno_t ctime_s( char* buffer, size_t sizeInBytes, const time_t *time ); // <time.h>

errno_t _ctime32_s( char* buffer, size_t sizeInBytes, const __time32_t *time ); // <time.h>

errno_t _ctime64_s( char* buffer, size_t sizeInBytes, const __time64_t *time ); // <time.h>

errno_t _wctime_s( wchar_t* buffer, size_t sizeInWords, const time_t *time ); // <time.h> or <wchar.h>

errno_t _wctime32_s( wchar_t* buffer, size_t sizeInWords, const __time32_t *time ); // <time.h> or <wchar.h>

errno_t _wctime64_s( wchar_t* buffer, size_t sizeInWords, const __time64_t *time ); // <time.h> or <wchar.h>

template <size_t size> errno_t _ctime32_s( char (&buffer)[size], const __time32_t *time ); //  <time.h> C++ only

template <size_t size> errno_t _ctime64_s( char (&buffer)[size], const __time64_t *time); // <time.h> C++ only

template <size_t size> errno_t _wctime32_s( wchar_t (&buffer)[size], const __time32_t *time ); // <time.h> or <wchar.h> C++ only

template <size_t size> errno_t _wctime64_s( wchar_t (&buffer)[size], const __time64_t *time ); // <time.h> or <wchar.h> C++ only

errno_t _ecvt_s( char * _Buffer, size_t _SizeInBytes, double _Value, int _Count, int *_Dec, int *_Sign); // <stdlib.h>

template <size_t size> errno_t _ecvt_s( char (&_Buffer)[size], double _Value, int _Count, int *_Dec, int *_Sign); // <stdlib.h> C++ only

errno_t fopen_s( FILE** pFile, const char *filename, const char *mode ); // <stdio.h>

errno_t _wfopen_s( FILE** pFile, const wchar_t *filename, const wchar_t *mode ); // <stdio.h> or <wchar.h>

int fprintf_s( FILE *stream, const char *format [, argument ]...); // <stdio.h>

int _fprintf_s_l( FILE *stream, const char *format, locale_t locale [, argument ]...); // <stdio.h>

int fwprintf_s( FILE *stream, const wchar_t *format [, argument ]...); // <stdio.h> or <wchar.h>

int _fwprintf_s_l( FILE *stream, const wchar_t *format, locale_t locale [, argument ]…); // <stdio.h> or <wchar.h>

errno_t freopen( FILE** pFile, const char *path, const char *mode, FILE *stream ); // <stdio.h>

errno_t _wfreopen( FILE** pFile, const wchar_t *path, const wchar_t *mode, FILE *stream ); // <stdio.h> or <wchar.h>

int fscanf_s( FILE *stream, const char *format [, argument ]... ); // <stdio.h>

int _fscanf_s_l( FILE *stream, const char *format, locale_t locale [, argument ]... ); // <stdio.h>

int fwscanf_s( FILE *stream, const wchar_t *format [, argument ]... ); // <stdio.h> or <wchar.h>

int _fwscanf_s_l( FILE *stream, const wchar_t *format, locale_t locale [, argument ]... ); // <stdio.h> or <wchar.h>

errno_t _ftime_s( struct _timeb *timeptr ); // <sys/types.h> & <sys/timeb.h>

errno_t _ftime32_s( struct __timeb32 *timeptr ); // <sys/types.h> & <sys/timeb.h>

errno_t _ftime64_s( struct __timeb64 *timeptr ); // <sys/types.h> & <sys/timeb.h>

errno_t _gcvt_s( char *buffer, size_t sizeInBytes, double value, int digits ); // <stdlib.h>

template <size_t cchStr> errno_t _gcvt_s( char (&buffer)[cchStr], double value, int digits ); // <stdlib.h> C++ only

errno_t getenv_s( size_t *pReturnValue, char* buffer, size_t sizeInBytes, const char *varname ); // <stdlib.h>

errno_t _wgetenv_s( size_t *pReturnValue, wchar_t *buffer, size_t sizeInWords, const wchar_t *varname ); // <stdlib.h> or <wchar.h>

template <size_t size> errno_t getenv_s( size_t *pReturnValue, char (&buffer)[size], const char *varname ); // <stdlib.h> C++ only

template <size_t size> errno_t _wgetenv_s( size_t *pReturnValue, wchar_t (&buffer)[size], const wchar_t *varname ); // <stdlib.h> or <wchar.h> C++ only

char *gets_s( char *buffer, size_t sizeInCharacters); // <stdio.h>

wchar_t *_getws_s( wchar_t *buffer, size_t sizeInCharacters); // <stdio.h> or <wchar.h>

template <size_t size> char *gets_s( char (&buffer)[size]); // <stdio.h> C++ only

template <size_t size> wchar_t *_getws_s( wchar_t (&buffer)[size]); // <stdio.h> or <wchar.h> C++ only

errno_t _gmtime_s( struct tm* _tm, const __time_t* time); // <time.h>

errno_t _gmtime32_s( struct tm* _tm, const __time32_t* time); // <time.h>

errno_t _gmtime64_s( struct tm* _tm, const __time64_t* time ); // <time.h>

errno_t _itoa_s( int value, char *buffer, size_t sizeInCharacters, int radix ); // <stdlib.h>

errno_t _i64toa_s( __int64 value, char *buffer, size_t sizeInCharacters, int radix ); // <stdlib.h>

errno_t _ui64toa_s( unsigned _int64 value, char *buffer, size_t sizeInCharacters, int radix ); // <stdlib.h>

errno_t _itow_s( int value, wchar_t *buffer, size_t sizeInCharacters, int radix ); // <stdlib.h>

errno_t _i64tow_s( __int64 value, wchar_t *buffer, size_t sizeInCharacters, int radix ); // <stdlib.h> or <wchar.h>

errno_t _ui64tow_s( unsigned __int64 value, wchar_t *buffer, size_t sizeInCharacters, int radix ); // <stdlib.h> or <wchar.h>

template <size_t size> errno_t _itoa_s( int value, char (&buffer)[size], int radix ); // <stdlib.h> or <wchar.h> C++ only

template <size_t size> errno_t _itow_s( int value, wchar_t (&buffer)[size], int radix ); // <stdlib.h> or <wchar.h> C++ only

void *_lfind_s( const void *key, const void *base, unsigned int *num, size_t size, int (__cdecl *compare)(void *, const void *, const void *), void * context); // <search.h>

errno_t _localtime_s( struct tm* _tm, const time_t *time ); // <time.h>

errno_t _localtime32_s( struct tm* _tm, const time32_t *time ); // <time.h>

errno_t _localtime64_s( struct tm* _tm, const _time64_t *time ); // <time.h>

void *_lsearch_s( const void *key, void *base, unsigned int *num, size_t size, int (__cdecl *compare)(void *, const void *, const void *), void * context); // <search.h>

errno_t _ltoa_s( long value, char *str, size_t sizeOfstr, int radix ); // <stdlib.h>

errno_t _ltow_s( long value, wchar_t *str, size_t sizeOfstr, int radix ); // <stdlib.h>

template <size_t size> errno_t _ltoa_s( long value, char (&str)[size], int radix ); // <stdlib.h> C++ only

template <size_t size> errno_t _ltow_s( long value, wchar_t (&str)[size], int radix ); // <stdlib.h> C++ only

errno_t _makepath_s( char *path, size_t sizeInCharacters, const char *drive, const char *dir, const char *fname, const char *ext ); // <stdlib.h>

errno_t _wmakepath_s( wchar_t *path, size_t sizeInCharacters, const wchar_t *drive, const wchar_t *dir, const wchar_t *fname, const wchar_t *ext ); // <stdlib.h> or <wchar.h>

template <size_t size> errno_t _makepath_s( char (&path)[size], const char *drive, const char *dir, const char *fname, const char *ext ); // <stdlib.h> C++ only

template <size_t size> errno_t _wmakepath_s( wchar_t (&path)[size], const wchar_t *drive, const wchar_t *dir, const wchar_t *fname, const wchar_t *ext ); // <stdlib.h> or <wchar.h> C++ only

errno_t _mbccpy_s( unsigned char *dest, size_t buffSizeInBytes, int * pCopied, const unsigned char *src ); // <mbctype.h>

errno_t _mbccpy_s_l( unsigned char *dest, size_t buffSizeInBytes, int * pCopied, const unsigned char *src, locale_t locale); // <mbctype.h>

template <size_t size> errno_t _mbccpy_s( unsigned char (&dest)[size], int * pCopied, const unsigned char *src ); // <mbctype.h> C++ only

template <size_t size> errno_t _mbccpy_s_l( unsigned char (&dest)[size], int * pCopied, const unsigned char *src, locale_t locale); // <mbctype.h> C++ only

errno_t _mbsnbcat_s( unsigned char *dest, size_t sizeInBytes, const unsigned char *src, size_t count ); // <mbstring.h>

errno_t _mbsnbcat_s_l( unsigned char *dest, size_t sizeInBytes, const unsigned char *src, size_t count, _locale_t locale); // <mbstring.h>

template <size_t size> errno_t _mbsnbcat_s( unsigned char (&dest)[size], const unsigned char *src, size_t count ); // <mbstring.h> C++ only

template <size_t size> errno_t _mbsnbcat_s_l( unsigned char (&dest)[size], const unsigned char *src, size_t count, _locale_t locale); // <mbstring.h> C++ only

errno_t _mbsnbcpy_s( unsigned char * strDest, size_t sizeInBytes, const unsigned char * strSource, size_t count ); // <mbstring.h>

errno_t _mbsnbcpy_s_l( unsigned char * strDest, size_t sizeInBytes, const unsigned char * strSource, size_t count, _locale_t locale); // <mbstring.h>

template <size_t size> errno_t _mbsnbcpy_s( unsigned char (&strDest)[size], const unsigned char * strSource, size_t count ); // <mbstring.h> C++ only

template <size_t size> errno_t _mbsnbcpy_s_l( unsigned char (&strDest)[size], const unsigned char * strSource, size_t count, _locale_t locale); // <mbstring.h> C++ only

errno_t mbsrtowcs_s( size_t *pReturnValue, wchar_t *wcstr, size_t sizeOfwcstr, const char **mbstr, size_t count, mbstate_t *mbstate); // <wchar.h>

template <size_t size> errno_t mbsrtowcs_s( size_t *pReturnValue, wchar_t (&wcstr)[size], const char **mbstr, size_t count, mbstate_t *mbstate); // <wchar.h> C++ only

errno_t mbstowcs_s( size_t *pConvertedChars, wchar_t *wcstr, size_t sizeInWords, const char *mbstr, size_t count ); // <stdlib.h>

errno_t _mbstowcs_s_l( size_t *pConvertedChars, wchar_t *wcstr, size_t sizeInWords, const char *mbstr, size_t count, _locale_t locale); // <stdlib.h>

template <size_t size> errno_t mbstowcs_s( size_t *pConvertedChars, wchar_t (&wcstr)[size], const char *mbstr, size_t count ); // <stdlib.h> C++ only

template <size_t size> errno_t _mbstowcs_s_l( size_t *pConvertedChars, wchar_t (&wcstr)[size], const char *mbstr, size_t count, _locale_t locale); // <stdlib.h> C++ only

errno_t memcpy_s( void *dest, size_t sizeInBytes, const void *src, size_t count ); // <memory.h> or <string.h>

errno_t wmemcpy_s( wchar_t *dest, size_t sizeInWords, const wchar_t *src, size_t count); // <wchar.h>

errno_t memmove_s( void *dest, size_t sizeInBytes, const void *src, size_t count ); // <string.h>

errno_t wmemmove_s( wchar_t *dest, size_t sizeInWords, const wchar_t *src, size_t count); // <wchar.h>

errno_t _mktemp_s( char *template, size_t sizeInChars); // <io.h>

errno_t _wmktemp_s( wchar_t *template, size_t sizeInChars); // <io.h> or <wchar.h>

template <size_t size> errno_t _mktemp_s( char (&template)[size]); // <io.h> C++ only

template <size_t size> errno_t _wmktemp_s( wchar_t (&template)[size]); // <io.h> or <wchar.h> C++ only

int printf_s( const char *format [, argument]... ); // <stdio.h>

int _printf_s_l( const char *format, locale_t locale [, argument]... ); // <stdio.h>

int wprintf_s( const wchar_t *format [, argument]... ); // <stdio.h> or <wchar.h>

int _wprintf_s_l( const wchar_t *format, locale_t locale [, argument]... ); // <stdio.h> or <wchar.h>

errno_t _putenv_s( const char *name, const char *value ); // <stdlib.h>

errno_t _wputenv_s( const wchar_t *name, const wchar_t *value); // <stdlib.h> or <wchar.h>

void qsort_s( void *base, size_t num, size_t width, int (__cdecl *compare )(void *, const void *, const void *), void * context); // <stdlib.h> & <search.h>

errno_t rand_s( unsigned int* randomValue); // <stdlib.h>

int scanf_s( const char *format [, argument]... ); // <stdio.h>

int _scanf_s_l( const char *format, locale_t locale [, argument]... ); // <stdio.h>

int wscanf_s( const wchar_t *format [, argument]... ); // <stdio.h> or <wchar.h>

int _wscanf_s_l( const wchar_t *format, locale_t locale [, argument]... ); // <stdio.h> or <wchar.h>

errno_t _searchenv_s( const char *filename, const char *varname, char *pathname, size_t sizeInBytes); // <stdlib.h>

errno_t _wsearchenv_s( const wchar_t *filename, const wchar_t *varname, wchar_t *pathname,

   size_t sizeInWords); // <stdlib.h> or <wchar.h>

template <size_t size> errno_t _searchenv_s( const char *filename, const char *varname, char (&pathname)[size]); // <stdlib.h> C++ only

template <size_t size> errno_t _wsearchenv_s( const wchar_t *filename, const wchar_t *varname,

   wchar_t (&pathname)[size]); // <stdlib.h> or <wchar.h> C++ only

int _snprintf_s( char *buffer, size_t sizeOfBuffer, size_t count, const char *format [, argument] ... ); // <stdio.h>

int _snprintf_s_l( char *buffer, size_t sizeOfBuffer, size_t count, const char *format, locale_t locale [, argument] ... ); // <stdio.h>

int _snwprintf_s( wchar_t *buffer, size_t sizeOfBuffer, size_t count, const wchar_t *format [, argument] ... ); // <stdio.h> or <wchar.h>

int _snwprintf_s_l( wchar_t *buffer, size_t sizeOfBuffer, size_t count, const wchar_t *format, locale_t locale [, argument] ... ); // <stdio.h> or <wchar.h>

template <size_t size> int _snprintf_s( char (&buffer)[size], size_t count, const char *format [,

      argument] ... ); // <stdio.h> C++ only

template <size_t size> int _snwprintf_s( wchar_t (&buffer)[size], size_t count, const wchar_t *format [, argument] ... ); // <stdio.h> or <wchar.h> C++ only

int __cdecl _snscanf_s( const char * input, size_t length, const char * format, ...); // <stdio.h>

int __cdecl _snscanf_s_l( const char * input, size_t length, const char * format, locale_t locale, ...); // <stdio.h>

int __cdecl _snwscanf_s( const wchar_t * input, size_t length, const wchar_t * format, ...); // <stdio.h> or <wchar.h>

int __cdecl _snwscanf_s_l( const wchar_t * input, size_t length, const wchar_t * format, locale_t locale, …); // <stdio.h> or <wchar.h>

errno_t _sopen_s( int* pfh, const char *filename, int oflag, int shflag, int pmode); // <io.h>

errno_t _wsopen_s( int* pfh, const wchar_t *filename, int oflag, int shflag, int pmode); // <io.h> or <wchar.h>

errno_t _splitpath_s( const char * path, char * drive, size_t driveSizeInCharacters, char * dir, size_t dirSizeInCharacters, char * fname, size_t nameSizeInCharacters, char * ext, size_t extSizeInBytes); // <stdlib.h>

errno_t _wsplitpath_s( const wchar_t * path, wchar_t * drive, size_t driveSizeInCharacters, wchar_t *dir, size_t dirSizeInCharacters, wchar_t * fname, size_t nameSizeInCharacters, wchar_t * ext, size_t extSizeInCharacters); // <stdlib.h> or <wchar.h>

template <size_t drivesize, size_t dirsize, size_t fnamesize, size_t extsize> errno_t _splitpath_s( const char *path, char (&drive)[drivesize], char (&dir)[dirsize], char (&fname)[fnamesize], char (&ext)[extsize]); // <stdlib.h> C++ only

template <size_t drivesize, size_t dirsize, size_t fnamesize, size_t extsize> errno_t _wsplitpath_s( const wchar_t *path, wchar_t (&drive)[size], wchar_t (&dir)[size], wchar_t (&fname)[size], wchar_t (&ext)[size]); // <stdlib.h> or <wchar.h> C++ only

int sprintf_s( char *buffer, size_t sizeOfBuffer, const char *format [, argument] ... ); // <stdio.h>

int _sprintf_s_l( char *buffer, size_t sizeOfBuffer, const char *format, locale_t locale [, argument] ... ); // <stdio.h>

int swprintf_s( wchar_t *buffer, size_t sizeOfBuffer, const wchar_t *format [, argument]...); // <stdio.h> or <wchar.h>

int _swprintf_s_l( wchar_t *buffer, size_t sizeOfBuffer, const wchar_t *format, locale_t locale [, argument]…); // <stdio.h> or <wchar.h>

template <size_t size> int sprintf_s( char (&buffer)[size], const char *format [, argument] ... ); // <stdio.h> C++ only

template <size_t size> int swprintf_s( wchar_t (&buffer)[size], const wchar_t *format [, argument]...); // <stdio.h> or <wchar.h> C++ only

int sscanf_s( const char *buffer, const char *format [, argument ] ...); // <stdio.h>

int _sscanf_s_l( const char *buffer, const char *format, locale_t locale [, argument ] ...); // <stdio.h>

int swscanf_s( const wchar_t *buffer, const wchar_t *format [, argument ] ...); // <stdio.h> or <wchar.h>

int _swscanf_s_l( const wchar_t *buffer, const wchar_t *format, locale_t locale [, argument ] ...); // <stdio.h> or <wchar.h>

errno_t strcat_s( char *strDestination, size_t sizeInBytes, const char *strSource ); // <string.h>

errno_t wcscat_s( wchar_t *strDestination, size_t sizeInWords, const wchar_t *strSource ); // <string.h> or <wchar.h>

errno_t _mbscat_s( unsigned char *strDestination, size_t sizeInBytes,const unsigned char *strSource ); // <mbstring.h>

template <size_t size> errno_t strcat_s( char (&strDestination)[size], const char *strSource ); // <string.h> C++ only

template <size_t size> errno_t wcscat_s( wchar_t (&strDestination)[size], const wchar_t *strSource ); // <string.h> or <wchar.h> C++ only

template <size_t size> errno_t _mbscat_s( unsigned char (&strDestination)[size], const unsigned char *strSource ); // <mbstring.h> C++ only

errno_t strcpy_s( char *strDestination, size_t sizeInBytes, const char *strSource ); // <string.h>

errno_t wcscpy_s( wchar_t *strDestination, size_t sizeInWords, const wchar_t *strSource ); // <string.h> or <wchar.h>

errno_t _mbscpy_s( unsigned char *strDestination, size_t sizeInBytes, const unsigned char *strSource ); // <mbstring.h>

template <size_t size> errno_t strcpy_s( char (&strDestination)[size], const char *strSource ); // <string.h> C++ only

template <size_t size> errno_t wcscpy_s( wchar_t (&strDestination)[size], const wchar_t *strSource ); // <string.h> or <wchar.h> C++ only

template <size_t size> errno_t _mbscpy_s( unsigned char (&strDestination)[size], const unsigned char *strSource ); // <mbstring.h> C++ only

errno_t _strdate_s( char *buffer, size_t sizeInBytes); // <time.h>

errno_t _wstrdate_s( wchar_t *buffer, size_t sizeInWords); // <time.h> or <wchar.h>

template <size_t size> errno_t _strdate_s( char (&buffer)[size]); // <time.h> C++ only

template <size_t size> errno_t _wstrdate_s( wchar_t (&buffer)[size]); // <time.h> or <wchar.h> C++ only

errno_t strerror_s( char *buffer, size_t sizeInBytes, int errnum ); // <string.h>

errno_t _strerror_s( char *buffer, size_t sizeInBytes, const char *strErrMsg ); // <string.h>

errno_t _wcserror_s( wchar_t *buffer, size_t sizeInWords, int errnum ); // <string.h> or <wchar.h>

errno_t __wcserror_s( wchar_t *buffer, size_t sizeInWords, const wchar_t *strErrMsg ); // <string.h> or <wchar.h>

template <size_t size> errno_t strerror_s( char (&buffer)[size], int errnum ); // <string.h> C++ only

template <size_t size> errno_t _strerror_s( char (&buffer)[size], const char *strErrMsg ); // <string.h> C++ only

template <size_t size> errno_t _wcserror_s( wchar_t (&buffer)[size], int errnum ); // <string.h> or <wchar.h> C++ only

template <size_t size> errno_t __wcserror_s( wchar_t (&buffer)[size], const wchar_t *strErrMsg ); // <string.h> or <wchar.h> C++ only

errno_t _strlwr_s( char *str, size_t sizeInBytes); // <string.h>

errno_t _strlwr_s_l( char *str, size_t sizeInBytes, _locale_t locale); // <string.h>

errno_t _mbslwr_s( unsigned char *str, size_t sizeInBytes); // <string.h> or <wchar.h>

errno_t _mbslwr_s_l( unsigned char *str, size_t sizeInBytes, _locale_t locale); // <string.h> or <wchar.h>

errno_t _wcslwr_s( wchar_t *str, size_t sizeInWords); // <string.h> or <wchar.h>

errno_t _wcslwr_s_l( wchar_t *str, size_t sizeInWords, _locale_t locale); // <string.h> or <wchar.h>

template <size_t size> errno_t _strlwr_s( char (&str)[size]); // <string.h> C++ only

template <size_t size> errno_t _strlwr_s_l( char (&str)[size], _locale_t locale); // <string.h> C++ only

template <size_t size> errno_t _mbslwr_s( unsigned char (&str)[size]); // <string.h> or <wchar.h> C++ only

template <size_t size> errno_t _mbslwr_s_l( unsigned char (&str)[size], _locale_t locale); // <string.h> or <wchar.h> C++ only

template <size_t size> errno_t _wcslwr_s( wchar_t (&str)[size]); // <string.h> or <wchar.h> C++ only

template <size_t size> errno_t _wcslwr_s_l( wchar_t (&str)[size], _locale_t locale); // <string.h> or <wchar.h> C++ only

errno_t strncat_s( char *strDest, size_t bufferSizeInBytes, const char *strSource, size_t count); // <string.h>

errno_t _strncat_s_l( char *strDest, size_t bufferSizeInBytes, const char *strSource, size_t count,

   _locale_t locale); // <string.h>

errno_t wcsncat_s( wchar_t *strDest, size_t bufferSizeInWords, const wchar_t *strSource, size_t count ); // <string.h> or <wchar.h>

errno_t _wcsncat_s_l( wchar_t *strDest, size_t bufferSizeInWords, const wchar_t *strSource, size_t count, _locale_t locale); // <string.h> or <wchar.h>

errno_t _mbsncat_s( unsigned char *strDest, size_t bufferSizeInBytes, const unsigned char *strSource, size_t count); // <mbstring.h>

errno_t _mbsncat_s_l( unsigned char *strDest, size_t bufferSizeInBytes, const unsigned char *strSource, size_t count, _locale_t locale); // <mbstring.h>

template <size_t size> errno_t strncat_s( char (&strDest)[size], const char *strSource, size_t count); // <string.h> C++ only

template <size_t size> errno_t _strncat_s_l( char (&strDest)[size], const char *strSource, size_t count, _locale_t locale); // <string.h> C++ only

template <size_t size> errno_t wcsncat_s( wchar_t (&strDest)[size], const wchar_t *strSource, size_t count ); // <string.h> or <wchar.h> C++ only

template <size_t size> errno_t _wcsncat_s_l( wchar_t (&strDest)[size], const wchar_t *strSource, size_t count, _locale_t locale); // <string.h> or <wchar.h> C++ only

template <size_t size> errno_t _mbsncat_s( unsigned char (&strDest)[size], const unsigned char *strSource, size_t count); // <mbstring.h> C++ only

template <size_t size> errno_t _mbsncat_s_l( unsigned char (&strDest)[size], const unsigned char *strSource, size_t count, _locale_t locale); // <mbstring.h> C++ only

errno_t strncpy_s( char *strDest, size_t sizeInBytes, const char *strSource, size_t count); // <string.h>

errno_t _strncpy_s_l( char *strDest, size_t sizeInBytes, const char *strSource, size_t count, _locale_t locale); // <string.h>

errno_t wcsncpy_s( wchar_t *strDest, size_t sizeInWords, const wchar_t *strSource, size_t count ); // <string.h> or <wchar.h>

errno_t _wcsncpy_s_l( wchar_t *strDest, size_t sizeInWords, const wchar_t *strSource, size_t count, _locale_t locale); // <string.h> or <wchar.h>

errno_t _mbsncpy_s( unsigned char *strDest, size_t sizeInBytes, const unsigned char *strSource, size_t count ); // <mbstring.h>

errno_t _mbsncpy_s_l( unsigned char *strDest, size_t sizeInBytes, const unsigned char *strSource, size_t count, locale_t locale); // <mbstring.h>

template <size_t size> errno_t strncpy_s( char (&strDest)[size], const char *strSource, size_t count); // <string.h> C++ only

template <size_t size> errno_t _strncpy_s_l( char (&strDest)[size], const char *strSource, size_t count, _locale_t locale); // <string.h> C++ only

template <size_t size> errno_t wcsncpy_s( wchar_t (&strDest)[size], const wchar_t *strSource, size_t count ); // <string.h> or <wchar.h> C++ only

template <size_t size> errno_t _wcsncpy_s_l( wchar_t (&strDest)[size], const wchar_t *strSource, size_t count, _locale_t locale); // <string.h> or <wchar.h> C++ only

template <size_t size> errno_t _mbsncpy_s( unsigned char (&strDest)[size], const unsigned char *strSource, size_t count ); // <mbstring.h> C++ only

template <size_t size> errno_t _mbsncpy_s_l( unsigned char (&strDest)[size], const unsigned char *strSource, size_t count, locale_t locale); // <mbstring.h> C++ only

errno_t _strtime_s( char *buffer, size_t sizeInBytes); // <time.h>

errno_t _wstrtime_s( wchar_t *buffer, size_t sizeInWords); // <time.h> or <wchar.h>

template <size_t size> errno_t _strtime_s( char (&buffer)[size]); // <time.h> C++ only

template <size_t size> errno_t _wstrtime_s( wchar_t (&buffer)[size]); // <time.h> or <wchar.h> C++ only

char *strtok_s( char *strToken, const char *strDelimit, char **context); // <string.h>

char *_strtok_s_l( char *strToken, const char *strDelimit, char **context, _locale_t locale); // <string.h>

wchar_t *wcstok_s( wchar_t *strToken, const wchar_t *strDelimit, wchar_t **context); // <string.h> or <wchar.h>

wchar_t *_wcstok_s_l( wchar_t *strToken, const wchar_t *strDelimit, wchar_t **context, _locale_t locale); // <string.h> or <wchar.h>

unsigned char *_mbstok_s( unsigned char*strToken, const unsigned char *strDelimit, char **context); // <mbstring.h>

unsigned char *_mbstok_s( unsigned char*strToken, const unsigned char *strDelimit, char **context, _locale_t locale); // <mbstring.h>

errno_t _strupr_s( char *str, size_t sizeInBytes); // <string.h> or <wchar.h>

errno_t _wcsupr_s( wchar_t * str, size_t sizeInWords); // <string.h> or <wchar.h>

errno_t _strupr_s_l( char * str, size_t sizeInBytes, _locale_t locale); // <string.h>

errno_t _wcsupr_s_l( wchar_t * str, size_t sizeInWords, _locale_t locale); // <string.h> or <wchar.h>

errno_t _mbsupr_s( unsigned char *str, size_t sizeInBytes); // <string.h> or <wchar.h>

errno_t _mbsupr_s_l( unsigned char *str, size_t sizeInBytes, _locale_t locale); // <string.h> or <wchar.h>

template <size_t size> errno_t _strupr_s( char (&str)[size]); // <string.h> C++ only

template <size_t size> errno_t _wcsupr_s( wchar_t (&str)[size]); // <string.h> or <wchar.h> C++ only

template <size_t size> errno_t _strupr_s_l( char (&str)[size], _locale_t locale); // <string.h> C++ only

template <size_t size> errno_t _wcsupr_s_l( wchar_t (&str)[size], _locale_t locale); // <string.h> or <wchar.h> C++ only

template <size_t size> errno_t _mbsupr_s( unsigned char (&str)[size]); // <string.h> or <wchar.h> C++ only

template <size_t size> errno_t _mbsupr_s_l( unsigned char (&str)[size], _locale_t locale); // <string.h> or <wchar.h> C++ only

errno_t tmpfile_s( FILE** pFilePtr); // <stdio.h>

errno_t tmpnam_s( char * str, size_t sizeInChars ); // <stdio.h>

errno_t _wtmpnam_s( wchar_t *str, size_t sizeInChars ); // <stdio.h> or <wchar.h>

template <size_t size> errno_t tmpnam_s( char (&str)[size]); // <stdio.h> C++ only

template <size_t size> errno_t _wtmpnam_s( wchar_t (&str)[size]); // <stdio.h> or <wchar.h> C++ only

errno_t _ultoa_s( unsigned long value, char *str, size_t sizeOfstr, int radix ); // <stdlib.h>

errno_t _ultow_s( unsigned long value, wchar_t *str, size_t sizeOfstr, int radix ); // <stdlib.h>

template <size_t size> errno_t _ultoa_s( unsigned long value, char (&str)[size], int radix ); // <stdlib.h> C++ only

template <size_t size> errno_t _ultow_s( unsigned long value, wchar_t (&str)[size], int radix ); // <stdlib.h> C++ only

errno_t _umask_s( int mode, int * pOldMode); // <io.h> & <sys/stat.h> & <sys/types.h>

int _vcprintf_s( const char* format, va_list argptr); // <conio.h> and <stdarg.h>

int _vcprintf_s_l( const char* format, locale_t locale, va_list argptr); // <conio.h> & <stdarg.h>

int _vcwprintf_s( const wchar_t* format, va_list argptr); // <conio.h> or <wchar.h>, and <stdarg.h>

int _vcwprintf_s_l( const wchar_t* format, locale_t locale, va_list argptr); // <conio.h> or <wchar.h>, and <stdarg.h>

int vfprintf_s( FILE *stream, const char *format, va_list argptr ); // <stdio.h> & <stdarg.h>

int _vfprintf_s_l( FILE *stream, const char *format, locale_t locale, va_list argptr ); // <stdio.h> & <stdarg.h>

int vfwprintf_s( FILE *stream, const wchar_t *format, va_list argptr ); // <stdio.h> or <wchar.h>, and <stdarg.h>

int _vfwprintf_s_l( FILE *stream, const wchar_t *format, locale_t locale, va_list argptr ); // <stdio.h> or <wchar.h>, and <stdarg.h>

int vprintf_s( const char *format, va_list argptr ); // <stdio.h> & <stdarg.h>

int _vprintf_s_l( const char *format, locale_t locale, va_list argptr ); // <stdio.h> & <stdarg.h>

int vwprintf_s( const wchar_t *format, va_list argptr ); // <stdio.h> or <wchar.h>, and <stdarg.h>

int _vwprintf_s_l( const wchar_t *format, locale_t locale, va_list argptr ); // <stdio.h> or <wchar.h>, and <stdarg.h>

errno_t wcrtomb_s( size_t *pReturnValue, char *mbchar, size_t sizeOfmbchar, wchar_t *wchar, mbstate_t *mbstate); // <wchar.h>

template <size_t size> errno_t wcrtomb_s( size_t *pReturnValue, char (&mbchar)[size], wchar_t *wchar, mbstate_t *mbstate); // <wchar.h> C++ only

errno_t wcsrtombs_s( size_t *pReturnValue, char *mbstr, size_t sizeOfmbstr, const wchar_t **wcstr, sizeof count, mbstate_t *mbstate); // <wchar.h>

template <size_t size> errno_t wcsrtombs_s( size_t *pReturnValue, char (&mbstr)[size], const wchar_t **wcstr, sizeof count, mbstate_t *mbstate); // <wchar.h> C++ only

errno_t wcstombs_s( size_t *pConvertedChars, char *mbstr, size_t sizeInBytes, const wchar_t *wcstr, size_t count ); // <stdlib.h>

errno_t _wcstombs_s_l( size_t *pConvertedChars, char *mbstr, size_t sizeInBytes, const wchar_t *wcstr, size_t count, _locale_t locale); // <stdlib.h>

template <size_t size> errno_t wcstombs_s( size_t *pConvertedChars, char (&mbstr)[size], const wchar_t *wcstr, size_t count ); // <stdlib.h> C++ only

template <size_t size> errno_t _wcstombs_s_l( size_t *pConvertedChars, char (&mbstr)[size], const wchar_t *wcstr, size_t count, _locale_t locale); // <stdlib.h> C++ only

errno_t wctomb_s( int *pRetValue, char *mbchar, size_t sizeInBytes, wchar_t wchar ); // <stdlib.h>

errno_t _wctomb_s_l( int *pRetValue, char *mbchar, size_t sizeInBytes, wchar_t wchar, _locale_t locale); // <stdlib.h>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值