#define MAX_TOKEN_SIZE 125 int GetTokenList(char* Query, int TokenCount, char Delimiter, char RetResult[][MAX_TOKEN_SIZE]) { int iRet = 0; char *ptrI = NULL; char *ptrX = NULL; char *ptrC = Query; while ( ptrC ) { __try { ptrI = strchr(ptrC++, Delimiter); ptrX = ptrI ? strchr(ptrI+1, Delimiter) : NULL; if ( ptrI != NULL && ptrX != NULL ) iRet++; else break; if ( iRet > TokenCount ) break; StringCchCopyNA(RetResult[iRet-1], MAX_TOKEN_SIZE, ptrI+1, ptrX-ptrI-1); // 'ad' ptrC = ptrX+1; } __except(1) { __noop; } } return iRet; }
최근 댓글