16,472
社区成员
发帖
与我相关
我的任务
分享
char szBuf[MAX_PATH];
CStdioFile csf;
CString str;
CDWordArray cdwa;
CFileDialog dlgOpen(TRUE,
NULL,
NULL,
OFN_PATHMUSTEXIST,
"Text File(*.txt)|*.txt|All File(*.*)|*.*|",
this);
dlgOpen.m_ofn.nMaxFile = 1;
dlgOpen.m_ofn.lpstrInitialDir = "C:\\";
dlgOpen.m_ofn.lpstrFile = szBuf;
dlgOpen.m_ofn.lpstrFile[0] = NULL;
if (IDOK == dlgOpen.DoModal())
{
if (csf.Open(dlgOpen.m_ofn.lpstrFile, CFile::modeRead | CFile::shareDenyNone | CFile::typeText))
{
while (csf.ReadString(str))
cdwa.Add(atoi(str.Right(str.GetLength() - str.Find('\t') - 1)));
csf.Close();
}
}