Untitled

 avatar
unknown
plain_text
2 years ago
754 B
8
Indexable
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define MAX 100
int menu(void);
void load(void);

struct catalog {
    char name[80];
    char title[80];
    char pub[80];
    unsigned date;
    unsigned char ed;
} cat[MAX];
int top = 0;
int main(void)
{
    int choice;
    load();
    return 0;
}
void load(void)
{
    FILE *fp;
    if((fp = fopen("catalog", "rb"))==NULL)
    {
        printf("catalog file not on disk.\n");
        return;
    }
    if(fread(&top, sizeof top, 1, fp)!=1)
    {
        printf("Error reading count.\n");
        exit(1);
    }
    if(fread(cat, sizeof cat, 1, fp)!=1)
    {
        printf("Error reading catalog data.\n");
        exit(1);
    }
    fclose(fp);
}
Editor is loading...