Find and replace strings in HEX in bin file

Hello.

I am trying to write a program changing the string (HEX) to another of the same length. I do it in C ++ and I have a bit of a problem (I'm just starting to research on the topic). I found a function that does this for one string and it works after modification, but I care that these strings to change were many (unspecified number with the possibility of appending). The code working with one string looks like this:

https://pastebin.com/k199k2WF

I would like to do this:

https://pastebin.com/9Bsu4rYs

because these strings will be changeable.

I tried to repeat: https://pastebin.com/2mcbmYgU

but there is a problem (error) of variable renaming and it does not look optimally. Can you help?
Registered users can post here. Sign in or register to post.