CString temp;
this->GetLine(0,temp.GetBuffer(4),4);
MessageBox(temp.GetAt(1),0,MB_OK);<-编译时出问题:
error C2664: 'CWnd::MessageBoxA' : cannot convert parameter 1 from 'ATL::CSimpleStringT<BaseType,t_bMFCDLL>::XCHAR' to 'LPCTSTR'
怎么办啊?
this->GetLine(0,temp.GetBuffer(4),4);
MessageBox(temp.GetAt(1),0,MB_OK);<-编译时出问题:
error C2664: 'CWnd::MessageBoxA' : cannot convert parameter 1 from 'ATL::CSimpleStringT<BaseType,t_bMFCDLL>::XCHAR' to 'LPCTSTR'
怎么办啊?
this->GetLine(0,temp.GetBuffer(4),4);
记得temp.ReleaseBuffer() ;
MessageBox((LPCTSTR)temp,0,MB_OK);<-编译时出问题:
szMessage[0] = temp.GetAt(1);
szMessage[1] = '\0\';
MessageBox(temp.GetAt(1),0,MB_OK);
我的目的是从一个CString字符串中读取每个字符,并用messagebox显示出来
for( int i = 0; 9 < temp.GetLength( ); i++ )
{
szChar[0] = temp[i];
Messageox( szChar );
}
for( int i = 0; i < temp.GetLength( ); i++ )
{
szChar[0] = temp[i];
Messageox( szChar );
}
str = Temp.GetAt(n);
MessageBox((LPCTSTR)&str,0,MB_OK);
应该就没有问题了
temp="ABCD";
for(int i=0;i<temp.GetLength();i++)
{
MessageBox(temp.Mid(i,1),0,MB_OK);
}
TCHAR str[2];
str[0] = Temp.GetAt(n);
str[1] = '\0';
MessageBox((LPCTSTR)str,0,MB_OK);
这里需要一个0终止符
for(i = 0; i < strTemp1; i++)
{
CString strTemp2(strTemp1.GetAt(i);
MessageBox(strTemp2);
}
char *pszChar = new char[nLen];lstrcpy(pszChar, temp);...