首页新闻找找看学习计划

vs2010 C++ 警告 “lstrcpyW”: 名称被标记为 #pragma deprecated

0
悬赏园豆:10 [待解决问题]

知道了这个函数可能将来不在支持,或者有不安全的成分。

搜了网上,都说是屏蔽掉这个警告。

但是这是掩耳盗铃啊,既然不推荐使用,都没有给出一个替换的函数。

Dean-Feng的主页 Dean-Feng | 菜鸟二级 | 园豆:202
提问于:2017-01-17 17:06
< >
分享
所有回答(2)
0

你看看有没有slstrcpyW?,

这个警告是,使用lstrcpyW时错误的拷贝可能产生内存越界, 这个其实不用理会。

灵枢 | 园豆:297 (菜鸟二级) | 2017-01-17 18:20
0

https://www.globalyzer.com/gzserver/help/reference/localeSensitiveMethods/winstrsafe.html

 

Recommended Replacements

Microsoft's strsafe calls and the calls that they replace are listed below. These tables were copied directly from the MSDN site.

strsafe.h character count functions

The following functions use a character count rather than a byte count.

 

 

strsafe.h function Replaces
StringCchCat, StringCchCatEx strcat, wcscat, lstrcat, strcat, StrCatBuff, _tcscat, _ftcscat
StringCchCatN, StringCchCatNEx strncat, StrNCat
StringCchCopy, StringCchCopyEx strcpy, wcscpy, lstrcpy, strcpy, _tcscpy, _ftcscpy
StringCchCopyN, StringCchCopyNEx strncpy
StringCchGets, StringCchGetsEx gets, _getws, _getts
StringCchPrintf, StringCchPrintfEx sprintf, swprintf, wsprintf, wnsprintf, _stprintf, _snprintf, _snwprintf, _sntprintf
StringCchVPrintf, StringCchVPrintfEx vsprintf, vswprintf, wvsprintf, wvnsprintf, _vstprintf, _vsnprintf, _vsnwprintf, _vsntprintf
StringCchLength strlen, lstrlen

 

strsafe.h byte count functions

The following functions use a byte count rather than a character count.

 

 

strsafe.h function Replaces
StringCbCat, StringCbCatEx strcat, wcscat, lstrcat, strcat, StrCatBuff, _tcscat, _ftcscat
StringCbCatN, StringCbCatNEx strncat, StrNCat
StringCbCopy, StringCbCopyEx strcpy, wcscpy, lstrcpy, strcpy, _tcscpy, _ftcscpy
StringCbCopyN, StringCbCopyNEx strncpy
StringCbGets, StringCbGetsEx gets, _getws, _getts
StringCbPrintf, StringCbPrintfEx sprintf, swprintf, wsprintf, wnsprintf, _stprintf, _snprintf, _snwprintf, _sntprintf
StringCbVPrintf, StringCbVPrintfEx vsprintf, vswprintf, wvsprintf, wvnsprintf, _vstprintf, _vsnprintf, _vsnwprintf, _vsntprintf
StringCbLength strlen, lstrlen
XiaoFaye | 园豆:3082 (老鸟四级) | 2017-01-18 07:05
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册