I was wonder if I can make 2 different size structures in a file. I wrote a code but It's apart of my school project and I havent compiled it yet, so Im just wondering will this work?
Code:
if((stsPtr = fopen("status.dat", "rb")) == NULL)
{
prinft("File could not be created/opened.\n");
Error();
}
else
{
fseek(stsPtr, 1 * sizeof(struct avail) SEEK_SET);
fread(&counts1, sizeof(struct avail), 1, stsPtr);
for(x = 0; x < 50; x++)
{
availSSlot[x] = counts.slot[x];
}
int cStudNum = sCount1;
int cStudNum1 = sCount2;
int cStudNum2 = sCount3;
int cStudNum3 = sCount4;
int cStudNum4 = sCount5;
int cStudNum5 = sCount6;
int cAccNum = aCount;
fseek(stsPtr, 0 * sizeof(struct stats) SEEK_SET);
fread(&counts, sizeof(struct stats), 1, stsPtr);
}
fclose(stsPtr);