Building a Find and Replace function for text editor

I'm building a find and replace function for my text editor and I need a little help.

I'm building the function without help from the algorithm header.

The function is written like:
doc.find_replace("Word_to_be_replaced", "The_word_that_is_replacing");
I find this very easy to understand replace this, with this.

find_replace will both have char * as their arguments.

The problem I'm having right now if I replace a bigger word for a smaller word how do I delete the extra characters from memory.

So if I replace "Goodbye" with "Hello" how do I delete the last two characters? So I don't print garbage code.

This is what I came up with just need to know how to delete characters from a vector<char>.
I'm redoing the code
Last edited on
Topic archived. No new replies allowed.