Record
Record
h>
#include<string.h>
// Function prototypes
void add_records();
void view_records();
void search_records();
void delete_records();
int main() {
int task;
do {
// Display menu options
printf("\n\nMenu:\nAdd student record: 1\nView Records: 2\nSearch Records:
3\nDelete Records: 4\nExit: 5\n\n");
return 0;
}
printf("\n\nSuccessfully opened.\n\n");
int i;
int i;
// Read student records from the file and display based on name
fread(&students, sizeof(struct student_record), n, fptr);
for (i = 0; i < n; i++) {
if (strcmp(search_name, students[i].name) == 0) {
printf("\nName: %s\n", students[i].name);
printf("Class: %s\n", students[i].class_name);
printf("Roll Number: %d\n", students[i].roll_number);
}
}
// Read student records from the file, delete unwanted records, and write to
the temporary file
// while (fread(&students, sizeof(struct student_record), 1, fptr) != 0) {
// // Check if the record is not unwanted (you can define your criteria
here)
// if (/* Define your criteria for unwanted records */) {
// // Write the record to the temporary file
// fwrite(&students, sizeof(struct student_record), 1, temp);
// // Decrease the total number of records ('n')
// n--;
// }
// // Move to the next record
// i++;
// }