_tcsncpy_s wcscpy_s 这两个字符串处理函数
下了个ButtonST类,
我在 ansi下,丫的 ,有以下警告, 我们不允许有警告, 我得想法子去掉警告啊
warning C4996: '_tcsncpy': This function or variable may be unsafe. Consider using _tcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
warning C4996: '_tcsncpy': This function or variable may be unsafe. Consider using _tcsncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
具体代码如下:
void BCMenuData::SetWideString(const wchar_t *szWideString)
{
delete[] m_szMenuText;//Need not check for NULL because ANSI X3J16 allows "delete NULL"
if (szWideString)
{
m_szMenuText = new wchar_t[sizeof(wchar_t)*(wcslen(szWideString)+1)];
if (m_szMenuText)
wcscpy(m_szMenuText,szWideString);
}
else
m_szMenuText=NULL;//set to NULL so we need not bother about dangling non-NULL Ptrs
}
DWORD CButtonST::SetURL(LPCTSTR lpszURL)
{
// Remove any existing URL
memset(m_szURL, 0, sizeof(m_szURL));
if (lpszURL)
{
// Store the URL
_tcsncpy(m_szURL, lpszURL, _MAX_PATH);
} // if
return BTNST_OK;
} // End of SetURL
怎么修改啊 ,我要去掉警告啊, 规定是这样的啊