MFC分割字符串

来源:互联网 发布:windows repair 中文 编辑:程序博客网 时间:2024/05/01 21:41

一切尽在代码中,各位自己看吧。还是非常好懂的。

//分割字符串void Split(CString strSource,CStringArray& strDest){strDest.RemoveAll();TCHAR seps[] = _T(" ");TCHAR *token,*next_token;token = _tcstok_s( (LPTSTR)(LPCTSTR)strSource, seps, &next_token);while( token != NULL ){strDest.Add(CString(token));token = _tcstok_s( NULL, seps, &next_token );}}