16,548
社区成员




CString strText =_T("01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33");
try
{
LPCTSTR szToken = _T(" ");
LPCTSTR szInsert = _T("\r\n");
int start = -1;
int end = 0;
int nCount = 0;
while(-1 != (start = strText.Find(szToken, end)))
{
++nCount;
if(0 == nCount%3)
{
strText.Insert(start+1, szInsert);
}
end = start + 1;
}
AfxMessageBox(strText);
CStdioFile file;
file.Open(_T("F:\\11.txt"), CFile::modeCreate|CFile::modeWrite);
file.WriteString(strText);
file.Close();
}
catch (CException* e)
{
e->ReportError();
e->Delete();
}