0

how to add and delete record of contact in address book???

i'm using void searchContact(void) to search the contact and i have done it
but i don't know how to proceed.
i'm trying to use
void addContact(void)
{}

void deleteContact(void)
{}
to do but i really don't know how to write the code...

can help me on my assignment?? thank you

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Ancient Dragon
0

I can only give you a vague answer because of your vague question

addContact: Information can only be added to the end of the file. How to do that depends on how the file is opened. See the open flags here.. My suggestion is to use the "a" flag so that the os will write all data to the end of the time.

deleteContact: There are several ways to handle this
1) Completly rewrite the entire file, leaving out the information to be deleted.

2) Write a special character to the beginning of a record that acts as a delete flag for the rest of your program. Other parts of the program that reads the file should just ignore records that have the delete indicator (flag) set. This is one method that is used when dealing with large files.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.