Hello

I am working on binary files management and I've done an excercise but don't know if it correct or not. I have tried to do 1 Here is the excercise:

Suppose you have a binary file called books.dat that contains informationabout unknown number of books of the following type:

struct Book
char title[140];
char category[50];
int edition;
int publish_year;
double price;


You are required to write a program that reads the contends of the fileand writes the books into 3 new binary files with the following conditions:

1. The books that have the category “Software Engineering” and are published after 2005 are written into the first file,

2. The books that have the category “Software Engineering” and are published before 2005 are written into the second file,

3. The rest of the books (the books that do not fulfil the conditions in 1or 2) must be written into the third file.


Here is the code:
insert
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>




struct Book
{
    char title[140];
    char category[50];
    int edition;
    int publish_year;
    double price;
};


int main()
{
    struct Book book;
    FILE *myfile = fopen("./my-data.dat", "rb");
    if (myfile == NULL) {
        printf("Could not open the file!\n");
        return 1;
    }
    while ( fread(&book, sizeof(struct Book), 1, myfile) )
    {
        if(book.category == "Software Engineering" && book.publish_year > 2005)
        {
            FILE *file1 = fopen("./data.dat", "wb");
            if (myfile == NULL) {
                printf("Could not open the file!\n");
                return 1;
            }
            fwrite(&book, sizeof(struct Book), 1, file1);
            fclose(file1);
        }
    }




    fclose(myfile);

return 0;