A simple console-based Student Record Management System written in C. This application provides a straightforward interface for managing student records with essential features like adding, displaying, searching, modifying, deleting, and sorting records. All data is persisted using binary file handling.
- Features
- Prerequisites
- File Structure
- Installation
- Compilation
- Usage
- Student ID Validation
- Data Storage
- Troubleshooting
- Project Structure
- Add Student: Add new student records with ID, Name, Branch, Year, Semester, and CGPA with automatic ID validation
- Display Students: View all stored student records in a tabular format
- Search Student: Find a specific student by their ID
- Modify Student: Update details (Name, Branch, Semester, CGPA) of an existing student
- Delete Student: Remove a student record permanently from the database
- Sort Students: Sort all records by ID in ascending order
- Data Persistence: All records are saved to
students.datand loaded automatically - Input Validation: Comprehensive validation for student IDs based on year of study
- Duplicate Prevention: System prevents adding duplicate student IDs
- C Compiler: GCC (GNU Compiler Collection) or any compatible C compiler
- Windows: MinGW, MSYS2, or Visual Studio with C/C++ support
- Linux: Usually pre-installed (
sudo apt-get install gccon Ubuntu/Debian) - macOS: Xcode Command Line Tools (
xcode-select --install)
- Operating System: Windows, Linux, or macOS
- Terminal/Command Prompt: For running the application
STUDENT RECORD MANAGEMENT SYSTEM/
β
βββ main.c # Main program entry point and menu loop
βββ student.c # Core functionality (CRUD operations, File I/O)
βββ student.h # Student structure and function prototypes
βββ students.dat # Binary data file (auto-generated)
βββ student_system.exe # Compiled executable (Windows)
βββ README.md # This file
main.c: Contains the main menu loop, user input handling, and program flow controlstudent.c: Implements all core functionality including:- Adding students with validation
- Displaying all students
- Searching for students
- Modifying student records
- Deleting students
- Sorting student records
student.h: Defines theStudentstructure and function prototypesstudents.dat: Binary file storing all student records (created automatically)
- Clone or Download the project to your local machine
- Navigate to the project directory using terminal/command prompt
- Ensure you have a C compiler installed (see Prerequisites)
Open Command Prompt or PowerShell in the project directory and run:
gcc main.c student.c -o student_system.exeOpen Terminal in the project directory and run:
gcc main.c student.c -o student_systemFor optimized builds, you can use:
gcc -Wall -O2 main.c student.c -o student_system-Wall: Enable all compiler warnings-O2: Enable optimization level 2
student_system.exe./student_system- Launch the Application: Run the compiled executable from the command line
- View Menu: The main menu will display with the following options:
1: Add a new student2: Display all students3: Search for a student4: Modify a student record5: Delete a student6: Sort all students by ID0: Exit the application
- Select Operation: Enter the number (0-6) corresponding to your desired action
- Follow Prompts: Enter the required information as prompted by the program
- Return to Menu: After completing an operation, you'll automatically return to the main menu
- Exit: Select option
0to exit the application
Adding a Student:
Select option 1
β Enter Year of Study (1-4): 2
β Enter Branch (e.g., CSE, ECE): CSE
β Enter Semester: 3
β Enter ID (Must start with AP24): AP24CS001
β Enter Name: John Doe
β Enter CGPA: 8.5
β Student added successfully!
Displaying All Students:
Select option 2
β View table showing all student records with columns:
ID, Name, Branch, Year, Sem, CGPA
Searching for a Student:
Select option 3
β Enter ID to search: AP24CS001
β View detailed information about the student
The system automatically validates student IDs based on the year of study to ensure data consistency:
| Year of Study | Required ID Prefix |
|---|---|
| 1st Year | AP25 |
| 2nd Year | AP24 |
| 3rd Year | AP23 |
| 4th Year | AP22 |
- β Student ID must start with the correct prefix for the selected year
- β Duplicate IDs are not allowed - the system checks for existing IDs
- β If validation fails, the system will prompt you to re-enter the ID
- β IDs are case-sensitive
- 1st Year Student: ID must start with
AP25(e.g.,AP25CS001,AP25ECE002) - 2nd Year Student: ID must start with
AP24(e.g.,AP24CS001,AP24ME003) - 3rd Year Student: ID must start with
AP23(e.g.,AP23CS001) - 4th Year Student: ID must start with
AP22(e.g.,AP22CS001)
- File Name:
students.dat - File Format: Binary format for efficient storage
- Storage Location: Created automatically in the same directory as the executable
- File Creation: The file is created automatically when you add the first student
Each student record contains the following fields:
- Student ID: Maximum 15 characters (e.g.,
AP24CS001) - Name: Maximum 50 characters
- Branch: Maximum 10 characters (e.g.,
CSE,ECE,ME) - Year of Study: Integer (1-4)
- Semester: Integer
- CGPA: Floating-point number (e.g.,
8.5,9.2)
- β All data is automatically saved immediately after each operation
- β Data persists between program runs - no need to save manually
- β The file remains intact even after closing the program
students.dat regularly to prevent data loss. You can simply copy the file to a safe location.
Error: undefined reference to 'function_name'
- Solution: Ensure all source files are included in the compilation command:
gcc main.c student.c -o student_system
Error: cannot find -lm or similar linker errors
- Solution: This is usually not needed for this project. If it occurs, try:
gcc main.c student.c -o student_system -lm
Error: Permission denied when compiling
- Solution: Close any running instances of the program, or compile with a different output name
Program exits immediately or closes right away
- Solution: Always run the program from command prompt/terminal, not by double-clicking the executable
- Windows: Open Command Prompt or PowerShell, navigate to the folder, then run
student_system.exe - Linux/macOS: Open Terminal, navigate to the folder, then run
./student_system
File permission errors
- Solution: Ensure you have read/write permissions in the program directory
- Windows: Run Command Prompt as Administrator if needed
- Linux/macOS: Check file permissions with
ls -land usechmodif necessary
Data not persisting or file not found
- Solution:
- Check if
students.datexists in the same directory as the executable - Ensure the program has write permissions in the directory
- Try running the program from the directory where it was compiled
- Check if
Invalid input causes program to hang
- Solution: The program handles most input errors, but if it hangs, press
Ctrl+Cto exit and restart
βββββββββββββββββββββββββββββββββββββββββββ
β main.c β
β - Program entry point β
β - Menu loop β
β - User input handling β
ββββββββββββββββ¬βββββββββββββββββββββββββββ
β
ββββΊ student.h (includes)
β
ββββββββββββββββΌβββββββββββββββββββββββββββ
β student.c β
β - addStudent() β
β - displayStudents() β
β - searchStudent() β
β - modifyStudent() β
β - deleteStudent() β
β - sortStudents() β
ββββββββββββββββ¬βββββββββββββββββββββββββββ
β
ββββΊ students.dat (file I/O)
- File I/O: The program uses binary file I/O for efficient data storage and fast access
- Case Sensitivity: Student IDs are case-sensitive (e.g.,
AP24CS001βap24cs001) - CGPA Format: CGPA values are stored as floating-point numbers (supports decimals like 8.5, 9.75)
- Sorting: The sort function sorts all students by ID in ascending alphabetical order
- Input Validation: All input validation is handled automatically - invalid inputs will prompt for re-entry
- No Manual Save: Data is saved automatically after each operation - no save button needed
- Year Restrictions: Year of Study must be between 1 and 4 (inclusive)
- Duplicate Prevention: The system automatically prevents adding duplicate student IDs
Potential improvements for future versions:
- π Export data to CSV/Excel format for external analysis
- π₯ Import data from external files (CSV, text files)
- π Advanced search functionality (search by name, branch, CGPA range, etc.)
- π Statistics and analytics (average CGPA, branch-wise statistics)
- π Password protection for data security
- π₯ Multi-user support with user authentication
- πΎ Built-in data backup and restore functionality
- π Generate reports and transcripts
- π¨ Enhanced user interface with better formatting
- π Undo/Redo functionality for operations
- Modular Design: Code is organized into separate files for maintainability
- Clear Naming: Functions and variables follow clear naming conventions
- Documentation: Key functions include comments for clarity
- Error Handling: Input validation and error checking throughout
To add a new feature to the system:
- Add Function Prototype: Add the function declaration to
student.h - Implement Function: Write the function implementation in
student.c - Add Menu Option: Add a new case in the switch statement in
main.c - Update Menu: Add the new option to the menu display in
main.c - Test: Test the new feature thoroughly
- Document: Update this README if the feature changes usage instructions
This project is open source and available for educational purposes.
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
If you encounter any issues or have questions:
- Check the Troubleshooting section above
- Review the code comments for implementation details
- Ensure all prerequisites are met
This project is open source and available for educational purposes. Feel free to use, modify, and distribute as needed.
Version: 1.0
Last Updated: 2024
Language: C (C99 Standard)
Platform: Windows, Linux, macOS
License: Open Source (Educational Use)