Skip to content

TheNameIsRKS/contact-management-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

83 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“± Contact Management System (C)

A console-based Contact Management System implemented in C, designed to manage a collection of contacts with robust input validation, file persistence, and vCard integration.


✨ Features

πŸ†• Add Contact

Prompts for Name, Phone, and Email.

Validates input using regex:

Name β†’ letters, spaces, hyphens, apostrophes (1–49 chars).

Phone β†’ Indian & International formats.

Email β†’ standard email pattern.

Sanitizes inputs (trims whitespace, removes commas).

Adds contact if valid and space is available.

πŸ‘€ View Contacts

Displays all contacts in a formatted table: Index | Name | Phone | Email.

πŸ” Search Contacts

Supports exact or partial name search (case-insensitive).

Displays results in a table format.

✏️ Update Contact

Select a contact by name.

Update Name, Phone, or Email individually.

Empty input retains old value.

Validations applied on new values.

πŸ—‘οΈ Delete Contact

Deletes contact by name with confirmation (Y/N).

Shifts array to maintain order after deletion.

πŸ”€ Sort Contacts

Sorts by Name, Phone, or Email using Merge Sort (O(n log n)).

πŸ’Ύ File Persistence

Saves contacts to contacts.txt in CSV format.

Loads existing contacts at startup.

Handles max contact limit gracefully.

πŸ“‡ vCard (VCF) Integration

Export: writes contacts to contacts.vcf (vCard 3.0), one phone (CELL) and one email (WORK) per contact.

Import: reads multiple VCARDs from a file, stores last TEL/EMAIL, stops at max contacts.

βœ… Input Validation & Sanitization

Regex-based validation for Name, Phone, Email, and menu choices.

Sanitizes inputs to prevent CSV/VCF formatting issues.

πŸ–₯️ User Interface

Menu-driven system with emoji feedback for actions: βœ…, ❌, ℹ️.

Clear prompts and error messages for invalid input.


πŸ› οΈ Installation & Compilation

Using CS50 IDE (recommended):

Navigate to the project directory:

cd path/to/advanced-contact-manager

Compile using make:

make advanced-contact-manager

Run the program:

./advanced-contact-manager

Without CS50 make:

If make is not available, you can compile manually with gcc:

gcc -o advanced-contact-manager advanced-contact-manager.c -Wall -std=c11
./advanced-contact-manager

βœ… Tip: Always run ./advanced-contact-manager from the project directory.


File Structure πŸ“‚

advanced-contact-manager/
β”œβ”€β”€ advanced-contact-manager.c   # Main C source code
β”œβ”€β”€ contacts.txt                 # Saved contacts (CSV)
β”œβ”€β”€ contacts.vcf                 # Exported contacts (vCard)
└── README.md                    # Project documentation

Note: contacts.txt and contacts.vcf not added here.


🧭 Usage

Upon starting, the system displays a menu:

image

βœ… Success and ❌ error messages guide the user throughout.

ℹ️ Informational messages appear for no changes or warnings.

πŸ’Ύ Data Storage

CSV File: contacts.txt (Name, Phone, Email)

VCF File: contacts.vcf (vCard 3.0 format)

Maximum of 100 contacts stored in memory at a time.

Automatic loading at startup and saving at exit.

πŸ“‚ File Format Details

CSV

Name, Phone, Email

John Doe, +919876543210, john@example.com

Jane Smith, +14155552671, jane@domain.com

vCard (VCF)

BEGIN:VCARD

VERSION:3.0

FN:John Doe

TEL;TYPE=CELL:+919876543210

EMAIL;TYPE=WORK:john@example.com

END:VCARD


βš™οΈ Technical Details

βœ… Implemented in C using structs and arrays.

βœ… Input validation with regex.

βœ… File I/O handling ensures data persistence.

βœ… Merge Sort used for efficient sorting.

βœ… Case-insensitive operations via strcasecmp().

βœ… Memory-safe with bounds checks and input sanitization.

⚠️ Maximum 100 contacts; additional entries ignored.


πŸ“ˆ Advantages

Easy-to-use menu interface.

Supports international phone numbers.

Emoji-based user-friendly feedback.

Import/export to standard vCard for cross-platform compatibility.


πŸ‘¨β€πŸ’» Future Enhancements

Prevent duplicate contacts during vCard import.

Add multiple phone numbers/emails per contact.

Implement search by phone or email.

Integrate graphical UI for better experience.


πŸ“ License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A robust console-based Contact Management System in C with features to add, view, search, update, delete, and sort contacts. Supports input validation, file-based persistence, and vCard import/export for seamless cross-platform contact management.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages