/*
errno_t strcpy_s(
char *strDestination,
size_t numberOfElements,
const char *strSource
);
errno_t wcscpy_s(
wchar_t *strDestination,
size_t numberOfElements,
const wchar_t *strSource
);
errno_t _mbscpy_s(
unsigned char *strDestination,
size_t numberOfElements,
const unsigned char *strSource
);
strDestination
Location of destination string buffer
numberOfElements
Size of the destination string buffer.
strSource
Null-terminated source string buffer.
_tcscpy_s是前面三个自动宏替换版本。
*/
// 非unicode
char strDst[ 10 ];
_tcscpy_s(strDst, 10 , strSrc);
// unicode
wchar_t strDst[ 10 ];
_tcscpy_s(strDst, 10 , strSrc);
对了,每二个参数填的是有多少个字符, 而不是有多少个字节(sizeof(strDst)) 在使用时一定要注意。
char *strDestination,
size_t numberOfElements,
const char *strSource
);
errno_t wcscpy_s(
wchar_t *strDestination,
size_t numberOfElements,
const wchar_t *strSource
);
errno_t _mbscpy_s(
unsigned char *strDestination,
size_t numberOfElements,
const unsigned char *strSource
);
strDestination
Location of destination string buffer
numberOfElements
Size of the destination string buffer.
strSource
Null-terminated source string buffer.
_tcscpy_s是前面三个自动宏替换版本。
*/
// 非unicode
char strDst[ 10 ];
_tcscpy_s(strDst, 10 , strSrc);
// unicode
wchar_t strDst[ 10 ];
_tcscpy_s(strDst, 10 , strSrc);