Monday, May 24, 2010

C/OOP: what is the exact code for deleting a record from file.?

Hi! Is there anyone good at C-language and OOP.





I have problem with deletion of record associated with filing. How a record can be deleted save in .txt file.


Please if anyone can help by writing the exact coding, I shall be obliged.


e.g in my filing program, I have stored name, address and number using structure.


f%26gt;%26gt;sub[i].name%26gt;%26gt;sub[i].address%26gt;%26gt;sub[i]...





Now how to delete this record from .txt file.

C/OOP: what is the exact code for deleting a record from file.?
I don't think you can actually 'delete' the record from the text file. What you will probably have to do is read through the file, line by line, and copy what you want to keep to a new text file, and leave out the stuff you want to "delete." Then, you delete the old file, and rename the new one. At least that is how I would do it. Perhaps someone else will post the exact code for you??? Good luck.


No comments:

Post a Comment