Participant *readRankingList(const char *filename, int *length) {
length = 0;
int i = 0;
FILE *fp;
fp = fopen(filename, "rb");
Participant *list;
if (fp == NULL) {
fprintf(stderr, "*** open of %s failed ***\n", filename);
return 0;
}
length = fread((void *)list, sizeof(Participant), LIST_LEN, fp);
while (fread(list, sizeof(length), 1, fp) > 0) {
list[i] = list;
i++;
}
free(list);
fclose(fp);
*length = i;
return list;
}
I have a binary file, which I open in this part. Now I want to store it with a dynamic storage.
At the moment I get a
Warning : assignment makes pointer from interfer without a cast
and an
Error: incompatible types when assigning to type Participant from type struct Participant