Employee Record System in C using File Handling
Employee Record System is software built to handle the primary housekeeping functions of a company. ERS helps companies keep track of all the employees and their records. It is used to manage the company using a computerized system. This software built to handle the records of employees of any company. It will help companies to keep track of all the employees’ records in a file.
Aim of the Employee’s Record System: The user will be provided with 5 options:
- Add a new record.
- Delete a record.
- Modify a record.
- View all the records.
Data of the Employees:
- Employee ID.
Approach: All the functions will be provided under switch cases. The idea is to use the concepts of File Handling to write the data in a text file and read the written data as well. We need to add a data.txt file in the same folder as well.
- The opening frame consists of the name of the application and the developer: It is created using some printf statements and a predefined function called system(). The system() function is a part of the C/C++ standard library. It is used to pass the commands that can be executed in the command processor or the terminal of the operating system and finally returns the command after it has been completed.
- system(“Color 3F”) will change the color of the console i.e. background (3) and the text on the console i.e. foreground (F).
- system(“pause”) will pause the screen, so the user will get a message: Press any key to continue . . .
- gotoxy() function: It will help to set the coordinates of the displayed data.
- Switch Case: The required function under the switch cases will be executed as per the input of the user. Simple file handling concepts like opening a file, closing a file, writing in a file, and reading the file, etc. are used to develop the code.
Below is the C program for the Employee record system:
- First displaying the name of software:
- Displaying all the options:
- Adding Records:
- Displaying Records:
- Delete a Record:
- Record After Deletion:
- Modifying or Editing a record:
- Record after Modification: