CString s;
s.Format(_T("The total is %d"),total);
int gg[4], tt[4];
int k = 0, p = 0;
char temp[50] = { '1', ':', '2', '0', '1', '2', '\n', 'r' , ':', '9', '\n' , 'd', ':' , '1' ,'2','\n','t',':','3','g','g','g','\n'};
for (int j = 0; j < sizeof(temp); j++){
if (temp[j] == ':'){
gg[k++] = j;
}
if (temp[j] == '\n'){
tt[p++] = j;
}
}
CString show;
show = temp;
CString year[4];
for (int i = 0; i < 4; i++){
year[i] = show.Mid(gg[i] + 1, tt[i] - gg[i] - 1); //获取字符A到字符B之间的字符串
}
//将数组转化为字符串
show.Format(_T("%S"),temp);
//发现第1个'f'字符
show.Find('f', 1);