枚举吧
int EnumString(char *str)
{
int nLen = strlen(str);
char *pTempBuf = new char[nLen + 1];
int nCount = 0;
for (int i = 0; i < nLen; i++)
{
char *pSubStr = str + i;
for (int j = 0; j < nLen - i; j++)
{
memcpy (pTempBuf, pSubStr, (j+1) * sizeof(char));
pTempBuf[j+1] = L'\0';
nCount ++;
printf("第 %d 个子字符串:%s.\n", nCount, pTempBuf);
}
}
delete []pTempBuf;
return nCount;
}
int main()
{
char *pString = "123456789";
EnumString(pString);
}