Code:
// Should be : void openInv(struct inventory *invDB), because you want it to be stored in a variable outside of the function scope
void openInv(struct inventory invDB)
{
// what is the type of disk_file? should be : FILE* disk_file = ...
disk_file = fopen("a:\\may.inv", "rb+");
// mainly a personal preference, but it should be : if(disk_file != NULL),
//as NULL is what is returned on error by fopen and you can't depend on NULL being
// defined as 0 on all computers
if (!disk_file) {
printf("Error: Disk\n");
exit(1);
}
// should be : fread((void*)invDB,sizeof(invDB), . . .); because
//fread needs a void * for the first argument. NOTE: for this part
//to work, you need to correct the mistakes I labeled above,
// because currently, even if you obeyed the first correction you
// would be getting alot of other syntax errors
fread(invDB, sizeof(invDB), 1, disk_file);
fclose(disk_file);
}
EDIT: I presume you know about pointers... if not, I suggest reading the tutorials on this site.