Hello, I'm struggling past 3 hours to achieve one simple task.
I have input.txt, output.txt and renamed.txt
output.txt has one word per line, I want to use this word to find it in input.txt and if there is one make it lowercase/lowercapital and write content of input.txt to renamed.txt
I tried find, i tried getline, i tried replace but I just can't seem to achieve what I want.
Output.txt content example:
s__NeatFormat__allocate
s__NeatFormat_deallocate
sc__Hero_create
s__Hero__allocate
s__Hero_deallocate
s__NeatWindow__allocate
s__NeatWindow_deallocate
sc___prototype1_execute
sc___prototype1_evaluate
sc___prototype30_execute
sc___prototype30_evaluate
sc___prototype32_execute
sc___prototype32_evaluate
sc___prototype35_execute
sc___prototype35_evaluate
HeroDeclaration
s__NeatFormat_create
s__NeatFormat_copy
s__NeatWindow_create
NeatMessages___ClearText
NeatMessages___GetAdjustedStringLength
NeatMessages___ChangeTextFormatting
NeatMessages___ChangeText
NeatMessages___HideTextMessage
NeatMessages___FadeoutLoop
NeatMessages___RepositionAllMessages
NeatMessages___AddTextMessage
I want to use these words to find them in input.txt (some words has a symbol after them, I need to somehow exclude those and make them get replaced too, like "Banana(" to "banana(", but not sure how), and make them lowercase, some are already, but I need to ensure all are in input.txt, and write them to renamed.txt
But I don't know how to approach it, this is my code so far:
int renameFunctions() {
std::ifstream inputFile("./input.txt");
std::ifstream outputFile("./output.txt");
std::ofstream renamedFile("./renamed.txt");
if (!inputFile.is_open() || !outputFile.is_open() || !renamedFile.is_open()) {
std::cout << "Could not open" << std::endl;
system("pause");
return 1;
}
std::string targetWord;
std::string replaceWord;
while (outputFile >> targetWord) {
}
}
the word to search for is in targetWord, now I need to read file outputFile, and find it in there and do the replacements, and do this for all words in outputFile