hi ppl...sorry for asking this again but im having a horrible time trying to prune this string...the string in 'word' could be anything like below: (ive put quotes so you know that there are spaces...otherwise there are no quotes in the string 'word'
i use getline to read in a line into word...now i need to extract only the words from the string excluding all spaces or newlines etc...Code:'*CLASS* alt yes no ' '*CLASS* alt hello right'
someone told me about using find() and then substr() but i don't know the size of the words...can be 3 letters or 2 or anything...
could someone show me how to use it...this is the code i have so far:
Regards,Code:ifstream in(filename); in >> word; //just to pick up the word *CLASS* //then i check if the word is *CLASS* //if it is then: in.getline(word); //this gets the whole line after *CLASS* //now i want to extract one word at a time and then do some operation on it //each word i extract should not have any spaces in it... while //what should be the condition in while? { word.substr(1,word.find(' ')) //then use the word }
Farooq