首页 > 代码库 > 【VC】warning C4996: 'XXXX': This function or variable may be unsafe.
【VC】warning C4996: 'XXXX': This function or variable may be unsafe.
关于VS系列使用 Unicode 格式产生以上警告:
warning C4996: 'wcscpy': This function or variable may be unsafe. Consider using wcscpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
MSDN
Generic-Text Routine Mappings TCHAR.H Routine _UNICODE Defined _tcscpy wcscpy
解决方案
项目 ->属性 -> c/c++ -> 预处理器 -> 预处理器定义,加入 _CRT_SECURE_NO_WARNINGS,即可。
Deprecated function | Security-enhanced replacement |
---|---|
_alloca | _malloca |
asctime | asctime_s |
_cgets, _cgetws | _cgets_s, _cgetws_s |
_chsize | _chsize_s |
_controlfp | _controlfp_s |
_creat | _sopen_s |
_cscanf | _cscanf_s |
_cscanf_l | _cscanf_s_l |
ctime | ctime_s |
_ctime32 | _ctime32_s |
_ctime64 | _ctime64_s |
_cwscanf | _cwscanf_s |
_cwscanf_l | _cwscanf_s_l |
_ecvt | _ecvt_s |
_fcvt | _fcvt_s |
fopen | fopen_s |
freopen | freopen_s |
fscanf | fscanf_s |
_fscanf_l | _fscanf_s_l |
fwscanf | fwscanf_s |
_fwscanf_l | _fwscanf_s_l |
_gcvt | _gcvt_s |
getenv | getenv_s |
gets, _getws | gets_s, _getws_s |
gmtime | _gmtime_s |
_gmtime32 | _gmtime32_s |
_gmtime64 | _gmtime64_s |
_i64toa | _i64toa_s |
_i64tow | _i64tow_s |
_itoa | _itoa_s |
_itow | _itow_s |
localtime | _localtime_s |
_localtime32 | _localtime32_s |
_localtime64 | _localtime64_s |
_ltoa, _ltow | _ltoa_s, _ltow_s |
_mbccpy | _mbccpy_s |
_mbccpy_l | _mbccpy_s_l |
_mbscat | _mbscat_s |
_mbscpy | _mbscpy_s |
_mbslwr, _mbslwr_l | _mbslwr_s, _mbslwr_s_l |
_mbsnbcat, _mbsnbcat_l | _mbsnbcat_s, _mbsnbcat_s_l |
_mbsnbcpy, _mbsnbcpy_l | _mbsnbcpy_s, _mbsnbcpy_s_l |
_mbsnbset | _mbsnbset_s |
_mbsnbset_l | _mbsnbset_s_l |
_mbsncat | _mbsncat_s |
_mbsncat_l | _mbsncat_s_l |
_mbsncpy | _mbsncpy_s |
_mbsncpy_l | _mbsncpy_s_l |
_mbsnset | _mbsnset_s |
_mbsnset_l | _mbsnset_s_l |
mbsrtowcs | mbsrtowcs_s |
_mbsset | _mbsset_s |
_mbsset_l | _mbsset_s_l |
_mbstok | _mbstok_s |
_mbstok_l | _mbstok_s_l |
mbstowcs, _mbstowcs_l | mbstowcs_s, _mbstowcs_s_l |
_mbsupr, _mbsupr_l | _mbsupr_s, _mbsupr_s_l |
memcpy | memcpy_s |
memmove | memmove_s |
_mktemp | _mktemp_s |
_open | _sopen_s |
scanf | scanf_s |
_scanf_l | _scanf_s_l |
_searchenv | _searchenv_s |
setbuf | setvbuf |
_snprintf | _snprintf_s |
_snprintf_l | _snprintf_s_l |
_snscanf | _snscanf_s |
_snscanf_l | _snscanf_s_l |
_snwprintf | _snwprintf_s |
_snwprintf_l | _snwprintf_s_l |
_snwscanf | _snwscanf_s |
_snwscanf_l | _snwscanf_s_l |
_sopen | _sopen_s |
_splitpath | _splitpath_s |
sprintf | sprintf_s |
_sprintf_l | _sprintf_s_l |
sscanf | sscanf_s |
_sscanf_l | _sscanf_s_l |
strcat | strcat_s |
strcpy | strcpy_s |
_strdate | _strdate_s |
strerror, _strerror | strerror_s, _strerror_s |
_strlwr, _strlwr_l | _strlwr_s, _strlwr_s_l |
strncat, _strncat_l | strncat_s, _strncat_s_l |
strncpy, _strncpy_l | strncpy_s, _strncpy_s_l |
_strnset | _strnset_s |
_strnset_l | _strnset_s_l |
_strset | _strset_s |
_strset_l | _strset_s_l |
_strtime | _strtime_s |
strtok | strtok_s |
_strtok_l | _strtok_s_l |
_strupr, _strupr_l | _strupr_s, _strupr_s_l |
swprintf | swprintf_s |
_swprintf_l | _swprintf_s_l |
swscanf | swscanf_s |
_swscanf_l | _swscanf_s_l |
tmpfile | tmpfile_s |
_ui64toa, _ui64tow | _ui64toa_s, _ui64tow_s |
_ultoa, _ultow | _ultoa_s, _ultow_s |
_umask | _umask_s |
vsnprintf, _vsnprintf, _vsnprintf_l, _vsnwprintf, _vsnwprintf_l | vsnprintf_s, _vsnprintf_s, _vsnprintf_s_l, _vsnwprintf_s, _vsnwprintf_s_l |
vsprintf, _vsprintf_l, vswprintf, _vswprintf_l, __vswprintf_l | vsprintf_s, _vsprintf_s_l, vswprintf_s, _vswprintf_s_l |
_wasctime | _wasctime_s |
_wcreat | _wsopen_s |
wcrtomb | wcrtomb_s |
wcscat | wcscat_s |
wcscpy | wcscpy_s |
_wcserror, __wcserror | _wcserror_s, __wcserror_s |
_wcslwr, _wcslwr_l | _wcslwr_s, _wcslwr_s_l |
wcsncat, wcsncat_l | wcsncat_s, _wcsncat_s_l |
_wcsncpy, _wcsncpy_l | wcsncpy_s, _wcsncpy_s_l |
_wcsnset, _wcsnset_l | _wcsnset_s, _wcsnset_s_l |
wcsrtombs | wcsrtombs_s |
_wcsset, _wcsset_l | _wcsset_s_wcsset_s_l |
wcstok, _wcstok_l | wcstok_s, _wcstok_s_l |
wcstombs, _wcstombs_l | wcstombs_s, _wcstombs_s_l |
_wcsupr_l, _wcsupr | _wcsupr_s, _wcsupr_s_l |
_wctime, _wctime32, _wctime64 | _wctime_s, _wctime32_s, _wctime64_s |
wctomb, _wctomb_l | wctomb_s, _wctomb_s_l |
_wfopen | _wfopen_s |
_wfreopen | _wfreopen_s |
_wgetenv | _wgetenv_s |
wmemcpy | wmemcpy_s |
wmemmove | wmemmove_s |
_wmktemp | _wmktemp_s |
_wopen | _wsopen_s |
_wscanf, _wscanf_l | _wscanf_s, _wscanf_s_l |
_wsearchenv | _wsearchenv_s |
_wsopen | _wsopen_s |
_wsplitpath | _wsplitpath_s |
_wstrdate | _wstrdate_s |
_wstrtime | _wstrtime_s |
【VC】warning C4996: 'XXXX': This function or variable may be unsafe.