this is my first time doing windows programming. its to split up each word in a sentenceCode:CString tmp;
vector <CString> eachword;
int i;
//split the thing up into words
for(i=0;i<=txtSource.StringLength(txtSource);i++){
//MessageBox(txtSource.Mid(i,1)); //debug
if(txtSource.Mid(i,1)==' '){
eachword.push_back(tmp);
tmp.Empty();
} else{
tmp+=txtSource.Mid(i,1);
}
}
eachword.push_back("ignorethis");
for(i=0;i<=eachword.size();i++){
MessageBox(eachword[i]);
}
suppose txtSource="hello how are you"
the message box will output
hello
how
are
ignorethis
[crashes]
or if i take out "ignorethis"
hello
how
are
[crashes]
if you change the sentence, itll do the same thing. any ideas?
