ive been trying to figure this out but i have no clue how to

ive got a string thats a whole file and ive used find and replace but that only works on the 1st of the word
if i have multiple of that word how could i replace them all?

i think this is close but although it compiled it doesnt seem to do anything

int x=0;
	while(x != std::string::npos) {
            x = alltext.find("<name>"), 
		alltext.erase(x, 6);

anyway hope someone can help
thanks

Recommended Answers

All 2 Replies

What is the value of std::string::npos when the loop starts?

Looks like a do-while would work better here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.