Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
removing records from a data file
To start out, I am learning C++ in an online class environment. This can make it hard to get prompt answers to question from instructors sometimes.
My question(s) is/are this:
I am trying to modify a program that, is supposed, to prompt you for an personel number, name, city, year, and salary. Once this is entered it places it in a file, also chosen by the user.
The program I am modifing came from a text website, so not sure how correct it was to start with. I then have to take this info and modify, find and the modification portion of the program is to add an option to delete a record. This is explained to define a function to writeNullToFile to overwrite the record to be deleted by a null record. This is explained as a nonnumeric (tombstone) in the first portion of the Personel number.
This will then be used to overwrite the record we search for and overwrite with the null record. Then the database destructor should be invoked, which will copy non-null records to a new data file, deletes the old one and renames the new data file with the name of the old data file.
We are given the .cpp files as well as the .h files for this project and have to modify them to work for this project. I have worked on this thing for quite a while and have gotten no where. I am confused on the tombstone character as well as the writeToNull function. We are also supposed to create a function called isNull() to check to see if a record is null, not even sure where this would be used. the modifications will be mostly on the personal and student cpp/h files. (I think)
I thank anyone in advance for helping out, I am seriously drowning.