main.c
int readInt(const char *file_path) {
    FILE *fd;
    char buf[255];
    int val = -1;

    if (!(fd = fopen(file_path, "r"))) {
        fprintf(stderr, "could not open %s for reading: %s\n", file_path, strerror(errno));
        return -1;
    }

    fread(buf, 255, 1, fd);
    val = atoi(buf);

    if (fclose(fd) != 0) {
        fprintf(stderr, "could not close %s: %s\n", file_path, strerror(errno));
        return -1;
    }

    return val;
}
// readInt returns integer written in the file or -1 in case of failure
readInt returns integer written in the file or -1 in case of failure
readInt returns integer written in the file or - 1 in case of failure
int readInt(const char *file_path) {
    FILE *fd;
    char buf[255];
    int val = -1;
    if (!(fd = fopen(file_path, "r"))) {
        fprintf(stderr, "could not open %s for reading: %s\n", file_path, strerror(errno));
        return -1;
    }
    fread(buf, 255, 1, fd);
    val = atoi(buf);
    if (fclose(fd) != 0) {
        fprintf(stderr, "could not close %s: %s\n", file_path, strerror(errno));
        return -1;
    }
    return val;
}
int readInt ( const char * file_path ) { FILE * fd ; char buf [ 255 ] ; int val = -1 ; if ( ! ( fd = fopen ( file_path , " " ) ) ) { fprintf ( stderr , " \n " , file_path , strerror ( errno ) ) ; return -1 ; } fread ( buf , 255 , 1 , fd ) ; val = atoi ( buf ) ; if ( fclose ( fd ) != 0 ) { fprintf ( stderr , " \n " , file_path , strerror ( errno ) ) ; return -1 ; } return val ; }
readInt returns integer written in the file or -1 in case of failure
readInt returns integer written in the file or - 1 in case of failure