I have a string like this: DialogTitle = IDD_SETTING_DLG
in a save file (i have already stored it in an array called m_TextArray
).
Now i want to get the "IDD_SETTING_DLG"
part(or at least " IDD_SETTING_DLG"
) and store it in a CString
variable. I used the Tokenize
method but it didn't work.
Here are my codes:
BOOL CTab1::OnInitDialog()
{
UpdateData();
ReadSaveFile();
SetTabDescription();
UpdateData(FALSE);
return TRUE;
}
void CTab1::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_SHOWDES, m_ShowDes);
}
void CTab1::ReadSaveFile()
{
if (!SaveFile.Open(SFLocation, CFile::modeRead | CFile::shareDenyWrite, &ex))
{
ReadSettingFile();
}
else
{
for (int i = 0; i < 100; i++)
{
SaveFile.ReadString(ReadLine);
m_TextArray[i] = ReadLine.GetString();
}
}
}
void CTab1::SetTabDescription() //m_TextArray[2] is where i stored the text
{
Position = 0;
Seperator = _T("=");
m_ShowDes = m_TextArray[2].Tokenize(Seperator, Position);
while (!m_ShowDes.IsEmpty())
{
// get the next token
m_ShowDes = m_TextArray[2].Tokenize(Seperator, Position);
}
}
Anyone solution or hint would be very appreciated.