Not sure if possible but..

A program i recently wrote for class was a grade book into a text file where I would have the user enter the Score earned for the class and then I would calculate and output information to a file and the console window. ex

Assignment User Input Percent Letter Grade
Assignment #1 (2%, 5) 5.0 100.0% A+
Assignment #2 (2%,5) ?
can't get alignment properly but the user input is 5.0
etc.
If there was a no grade hit enter and no value and no calculation was performed. So I was wandering with the outfile command if it is possible to go back and redo a set line like with a string compare command to find the sub and over write with new info or if you can only append from the end of file.
Last edited on
Yes, of course it is possible. Anyway what often happens is that it is not that easy to change the content of a file. An easier idea would be to create another file and then substitute it to the old one.

For instance, let's say you have a file composed of 10 lines and you want to change the 4th. Then you can create a new file, copy the initial three lines, write the new fourth line, and the copy the remaining six ones.
When you have done, you can delete the original file and rename the new one so that it has the same name of the old one. From the outside, it will appear as though you have modified the file.
Thank you very much didn't think of that
Topic archived. No new replies allowed.