Here's the code. I have no idea why it doesn't recognize that it needs to copy the memory, and I can't force it to.
string message="The quick brown fox jumped over the lazy dog.";
vector<char*> words;
while(message.length()>0){
char wtf[message.substr(0,message.find(" ")).c_str().length()]=message.substr(0,message.find(" ")).c_str();
words.push_back(wtf);
message=message.substr(message.find(" ")+1);
}
I see that there are similar threads, but none on this. Also, it seems like a shortcomming that C++ can't deal with this that easily.