Here's a string tokenizer function. I didn't test it, but i think it should work..
Code:
/*****************************\
* String tokenizer *
* Input: *
* inStr ->Input string *
* p ->Position array *
* chDelim ->Delimiter *
\*****************************/
int fixInStr(char *inStr, short *p, char chDelim){
char *p1=inStr;
int i(-1);
if(*p1==chDelim){ // Handle delimiter in pos. 0
*p1=0;
p[++i]=0;
}
while((p1=strchr(p1+1, chDelim))){ // Find all tokens
*p1=0;
p[++i]=(p1-inStr)+1;
}
p1=0;
return(i+1);
}
// Test
int main(){
char achTest[] = "Test|of|string|tokenizer";
short posArray[10], i(0), j(0);
if((i=strtok_1(achTest, &posArray, '|'))){
cout<<"Result\n";
while(j<i)
cout<<achTest[j++]<<endl;
}
return(0);
}