|
-
July 4th, 2012, 03:44 AM
#1
Trouble with the CString class
Hi everyone,
I am trying to use the CString class to concatenate some string but i am getting a strange compiler error. The code is as follows:
void CTesterDlg::OnBnClickedButton1()
{
UpdateData(TRUE);
m_Output=m_Hostname+"and";
SetDlgItemText(IDC_EDIT2,m_Output);
}
Where m_Output and m_Hostname are CString variables.
The compiler error is this:
1>c:\documents and settings\administrator\my documents\visual studio 2005\projects\router monkey\router monkey\router monkeydlg.cpp(169) : error C2679: binary '+' : no operator found which takes a right-hand operand of type 'const char [2]' (or there is no acceptable conversion)
1> e:\visual studio 8\vc\atlmfc\include\atlsimpstr.h(666): could be 'ATL::CSimpleStringT<BaseType> ATL::CSimpleStringT<BaseType>: perator +(const ATL::CSimpleStringT<BaseType> &,const ATL::CSimpleStringT<BaseType> &)' [found using argument-dependent lookup]
Anyone know why this error is happening and how i can fix it ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|