Another, simpler idea, is to create an extracter function that converts the string into an array of zstrings, then simply extracts the requested substring by index. EX:
BOOL GetSubStringByIndex(int iIndexValue, int iSubstring, LPTSTR cpRetval)
{
TCHAR caBuf[512];
*cpRetval = 0;
int iOffset = 0;
m_listItem.GetText(indexValue,caBuf);
caBuf[_tcslen(caBuf)+1] = 0;
LPTSTR cpSeg = caBuf;
while (*cpSeg)
{
if (*cpSeg == ' ')
*cpSeg = 0;
cpSeg++;
}
cpSeg = caBuf;
while (*cpSeg)
{
if (iOffset == iSubstring)
{
_tcscpy(cpRetval,cpSeg);
return TRUE;
}
cpSeg += _tcslen(cpSeg)+1;
iOffset++;
}
return FALSE;
}