Original Post
I am taking a c++ class, and our discussion turned to sequential files. A file for a phone book, with a name, address, and phone number, would look like this...
John Smith, 123 Street, 555-1212, Jill Stokes, 345 Another Street, 555-1313, ect...The problem is with updating or deleting records. I have never done this before, but what the instructor said sounded a little odd. He said there was two ways of updating or deleting a record. Read in the whole thing into arrays, change what you need, and write everything back to the file, or have a new output file, and as you are searching for the file you want, put all the records into the output file until the correct file is found. Then change or delete that record, write it to the output( if not deleting ) and then write everything else to the new file. The delete the original file, and rename the output file to the original. This seems like a lot of work to me, but I have never had to make any changes to a text file like this before, so I was not sure if this is how it is done, or is the guy crazy. I am using c++ for the code. Does anyone have any insite into this problem? Glass_Knife I think, therfore I am. I think?