#include <iostream>
#include <string>
usingnamespace std;
int main ()
{
string textout;
size_t pos;
string test = "User=1234 User=5678 User=12345";
pos = test.find("User");
textout = test.substr (pos, 9);
cout << textout; // This will only output first User, if i want next one? tried a "while" function but it only repeated the first search.
system("PAUSE");
return 0;
}
There is another way to call find, in which you tell it where in the string to start looking. It is up to you to keep track of where you have already looked.