1、字符串函数
cscpy、wcscpy等字符串函数不再允许使用,改为后面带_s的函数,并且每传入一个非const的字符串指针,都会要求后面跟一个表示字符串指针长度的参数
老代码:
wchar_t strTmp[100] = {0};
wcscpy(strTmp, L”This is a Sample!”);
新代码:
wchar_t strTmp[100] = {0};
wcscpy_s(strTmp, 100, L”This is a Sample!”);
void BCMenuData::SetWideString(const wchar_t *szWideString)
{
delete[] m_szMenuText;//Need not check for NULL because ANSI X3J16 allows "delete NULL"
if (szWideString)
{
int size = sizeof(wchar_t)*(wcslen(szWideString)+1);
m_szMenuText = new wchar_t[size];
if (m_szMenuText)
wcscpy_s(m_szMenuText, size, szWideString);
}
else
m_szMenuText=NULL;//set to NULL so we need not bother about dangling non-NULL Ptrs
}