大家请看一下为什么
CString对象"m_strRead"我调用过函数"GetBuffer()"BOOL CPhBkDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CString str;
CFile file("NAME.txt",CFile::modeRead);
file.SeekToBegin();
file.Read(m_strRead.GetBuffer(file.GetLength()),file.GetLength());
int pos=m_strRead.Find("-");
m_strRead=(CString)m_strRead;
str=m_strRead.Left(pos);
MessageBox(str);
((CComboBox*)GetDlgItem(IDC_LOOK))->AddString(str); // Add "About..." menu item to system menu.
.......
}
CString对象"m_strRead"我调用过函数"GetBuffer()"BOOL CPhBkDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CString str;
CFile file("NAME.txt",CFile::modeRead);
file.SeekToBegin();
file.Read(m_strRead.GetBuffer(file.GetLength()),file.GetLength());
int pos=m_strRead.Find("-");
m_strRead=(CString)m_strRead;
str=m_strRead.Left(pos);
MessageBox(str);
((CComboBox*)GetDlgItem(IDC_LOOK))->AddString(str); // Add "About..." menu item to system menu.
.......
}
int pos=m_strRead.Find("-");
m_strRead=(CString)m_strRead;
str=m_strRead.Left(pos);
MessageBox(str);
红色那两行换一下 然后打断点跟踪下m_strRead Pos str的值看是否正确我试了下 是可以的