Hi
I have a quastion.
I want to replace characters in this prog.
but the found value prints :4294967295
i dont understand why this happen?
#include<iostream>
#include <vector>
#include <string>
#include <sstream>
using namespace std;
int main()
{
string str("aa bb cc dd <ee> ff <gg> hh <ii> jj"),search,replace;
cout<<str;
string buf;
stringstream ss(str); // Insert the string into a stream
vector<string> tokens;
vector<string>::iterator iter;
while (ss >> buf)
tokens.push_back(buf);
iter = tokens.begin()+2;
while( iter != tokens.end())
{
cout << endl<<*iter ;
search="<" + *iter + ">";
iter++;
replace=*iter;
size_t found=str.find( search,0);
cout<<"found:"<<found<<endl;
while ( found != string::npos )
{
str.replace( found, search.size(), replace);
cout<<"str:"<<str<<"+++++";
found = str.find( search, found+replace.size()+1 );
}
*iter++;
}
cout<<"Now string is:"<<str;
}
please help me.
Thanks.