I'm trying to learn how to parse a text file, ideally I want to find and change just the numerical values and output the file with the same formatting.
Using getline with a string variable strips the lines of the newline character. What is the best way to go about parsing a program/code file to modify values and then reoutput them?
If you use getline, you can read each character one at a time, determine what it is (a numerical value?), and if it is what you want to change, write a new value to a different string. Otherwise, write the value you read in. Once you finish iterating over the string, add the '\n' character for your newline. Then write that new string to a new file.