Reading Text File and Appending

Pages: 123
Preferably the first occurrence regardless of whether or not what it is set to.
@Vendetto. Are you down a rabbit hole? There was an initial requirement, then a second, third etc and now this - all done with changes to previous code.

IMO I'd suggest taking a step back, look carefully as to what is actually required and write a detailed spec as to exactly what changes to the input file are required for the output file. Once this is done, then the program can be designed around the spec, then coded - rather than some ad-hoc changes to existing code. First spec, then design, then code then test/debug.
I can see why you would ask that. Originally the idea was to come up with a program that would allow me and other field engineers to add setting lines to config files quicker than having to copy and paste to each machine when potentially there could be hundreds on one site. Well after I got started with the first code set I realized that there might be times things were laid out differently due to various changes in versions of the software over the years. That is what then led to all the additional things. So ultimately we would be faced with a config file and need to add new lines to it. However this config file might not have the settings section at the end or be spaced in lines like others and can quite possibly have lines it in already from previous troubleshooting that would be duplicated. So it didn’t develop eloquently because I was taking the opportunity to learn how to do something then the next step but the comparison of a lone whether or not it is true or false is the final hurdle.
Topic archived. No new replies allowed.
Pages: 123