So Im trying to write some code that takes a chunk of text, splits it up into words, then puts these words into an array. What I have is:
string buf;
stringstream ss(database); // database is my chunk of text
while (ss >> buf) // Tokenize when whitespace met
{
???
}
So in that while loop I want to take the string "buf" and put it into an array. Thus the result is an array of strings containing every word in the paragraph. This is where I feel like an idiot.
I have tried a few ways using string streams and converting strings to char arrays etc, but nothing will work for me. I have a feeling that this has to do with multidimensional arrays and pointers, but my searches have been fruitless.
Thanks in advance!