Possible Duplicate:
Reaching a specific word in a string
I asked a very similar question but apparently I asked it wrong. The question is that I need to reach the 3rd word in a string in C++ and the string is like this:
word1\tword2\tword3\tword4\tword5\tword6
word2 can have spaces inside.
I tried to read the string character by character but I found it inefficient. I tried code
std::istringstream str(array[i]);
str >> temp >> temp >> word;
array2[i] = word;
and it didn’t work because of the spaces inside word2.
Can you tell me how I can do that?
The most straightforward way:
output: