This code works
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    FILE *file = fopen("file.txt", "rb"); /* Replace file.txt with your file name */
    /* Get the size of the file */
    fseek(file, 0, SEEK_END);
    long size = ftell(file);
    fseek(file, 0, SEEK_SET);
    /* Allocate memory for the file content */
    char *content = calloc(size + 1, sizeof(char)); /* calloc() initialises all memory to zero */
    /* Read the file content into memory */
    fread(content, sizeof(char), size, file);
    fclose(file);
    /* Find \r\n in file */
    char *pos = strstr(content, "\r\n"); /* strstr() finds the first occurrence of the substring */
    if (pos == NULL) {
        /* The file does not have \r\n so is not valid */
        fprintf(stderr, "The file is not valid\n");
        return 1;
    }
    /* Null terminate the string to hide \r\n */
    /* Data after it still remains but is not accessed */
    *pos = '\0';
    /* Do whatever you want with the file content */
    /* Free the memory */
    free(content);
    return 0;
}