I am creating my own string tokenizer - yet I am having problem with my nextToken method - the method should return the next token and move the counter to the start of the next token. I am having issues with appended a character on to the end of a temp string - here is my method -
char* nextToken(stringTokenizer *strTok)
{
char *tempString;
char delim;
int index;
tempString = (char *)malloc(20*sizeof(char));
delim=(*strTok)->delimiter;
index=(*strTok)->currIndex;
while(((*strTok)->charLine[index])!= delim)
{
//append (*strTok)->charLine[index] to
//tempString ?????
index++;
}
(*strTok)->currIndex = index+1;
return tempString;
}
how can I append a char each time to my temp string???
cheers!
char* nextToken(stringTokenizer *strTok)
{
char *tempString;
char delim;
int index;
tempString = (char *)malloc(20*sizeof(char));
delim=(*strTok)->delimiter;
index=(*strTok)->currIndex;
while(((*strTok)->charLine[index])!= delim)
{
//append (*strTok)->charLine[index] to
//tempString ?????
index++;
}
(*strTok)->currIndex = index+1;
return tempString;
}
how can I append a char each time to my temp string???
cheers!