i need help.
i need to write a code that can extract word from string.
i had use cin.getline(string,size) to get th string and strtok(string," ") to extarct token. now i want to know how can i insert the token in array because i want to use the token for other purpose.
this what i had write
const size=100;
char string;
char *tokenPtr;
cout<<"string\n";
cin.getline(string,size);
tokenPtr =strtok(string," "); //bring string1 by separated by characters in string2
while (tokenPtr != NULL)
{
cout<<tokenPtr<<"\n";
tokenPtr=strtok(NULL," ");
}
i had come across function strcspn, and i want to know how it work.
please give me some idea?
thank your.