error C2679: binary '+' no operator found which takes a right-hand operand of type 'const cha

void CExampleViewView::OnInitialUpdate()
{
CView::OnInitialUpdate();

// TODO: Add your specialized code here and/or call the base class
CRect rcClient;
GetClientRect(rcClient);
if(m_ctrlEdit) delete m_ctrlEdit;

m_ctrlEdit = new CEdit();
m_ctrlEdit ->Create(ES_MULTILINE|WS_CHILD|WS_VISIBLE|WS_HSCROLL|ES_AUTOHSCROLL|WS_VSCROLL|ES_AUTOVSCROLL,rcClient, this, 201);
CExampleViewDoc* pDoc = GetDocument();
CString str;
int nLines = (int)pDoc->m_strContent.GetSize();
for(int i=0;i<nLines; i++)
{
str = str + pDoc->m_strContent.GetAt(i);
str = str + "\r\n";
}
m_ctrlEdit->SetTabStops(16);
m_ctrlEdit->SetWindowText(str);
}

这一句

str = str + "\r\n";

改成

str = str + _T("\r\n");


应该是由于开启了Unicode。所以CString内部类型实际是wchar_t而不是char,你在操作裸字符串的时候也要加上_T()宏以表示是宽字符集。

温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网