quya
June 12th, 2002, 10:22 PM
Hi!
I have a code here which is uncompleted one, what i want to do is actually to store each string that is "two" and "three" in an array of strings so that i can use them separately later on. But i'm not sure how to do it. I can only separate them using strtok but no idea how to store them. Can somebody help me pls. Thanks!
char string[]={"two;three;"};
char *tokenPtr;
tokenPtr=strtok(string,";");
while (tokenPtr != NULL)
{
cout<<tokenPtr<<endl;
tokenPtr=strtok(NULL, ";");
}
I have a code here which is uncompleted one, what i want to do is actually to store each string that is "two" and "three" in an array of strings so that i can use them separately later on. But i'm not sure how to do it. I can only separate them using strtok but no idea how to store them. Can somebody help me pls. Thanks!
char string[]={"two;three;"};
char *tokenPtr;
tokenPtr=strtok(string,";");
while (tokenPtr != NULL)
{
cout<<tokenPtr<<endl;
tokenPtr=strtok(NULL, ";");
}