THIS IS A C PROGRAMMING TASK
lab6_skeleton.c
test_case_6.txt
test_case_8.txt
In this lab, you are given a binary file employees.bin which contains records of employees in a company. Each employee record will be stored using employeeData struct. typedef struct { unsigned int id; // employee id char name [20]; // employee name char department [20]; // department of employee int birthYear; // birth year of employee int salary; // salary of employee } employeeData; employees.bin file consists of 100 records. 94 of them are blank records. The other 6 records (not blank) are placed in specific positions of the binary file based on their ids. For example, if id of an employee is 5, its record is the fifth record in the file. The size of each record is equal to the size of employeeData struct. The records are sorted according to their id number. Complete the skeleton code lab6_skeleton.c by implementing the following 4 functions. Part 3 int deleteEmployee (FILE *filePtr, unsigned int id); Takes FILE pointer to the binary file. Deletes the record of the employee whose id is provided in the parameter id by setting its fields to {0, "", "", 0, 0}. If there is an employee record with the given id, it is deleted and the function returns 1; otherwise, it returns 0. For sample run, see test_case_6.txt in Moodle. Part 4 int showDepartmentRecords (FILE *filePtr, char department []); Takes FILE pointer to the binary file. Prints employee records whose department field is the same as the parameter department and returns the number of printed employee records. For sample run, see test_case_8.txt in Moodle.
THIS IS A C PROGRAMMING TASK lab6_skeleton.c test_case_6.txt test_case_8.txt
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am