i am trying to copy a string that i got from a file using fscanf into my struct
Code:
struct Room {
char south, north, east, west;
char id;
char description[MAX_SIZE_DESC];
char name[MAX_SIZE_NAME];
};
int buildRooms(char filename[], struct Room list[])
{
char id[2];
char roomname [20];
char north[2];
char east[2];
char west[2];
char south[2];
char sentence [100];
char space[4];
FILE *f = fopen(filename, "r");
if (f == NULL) {
fprintf(stderr, "Error opening game file %s./n", filename);
return 42;} // failure
else{
fscanf(f,"%s%s%s%s%s%s",id, roomname, north, east, west, south);
fgets(space, sizeof(space),f);
fgets(sentence, sizeof(sentence),f);
struct Room list;
strcpy(list.id, id);
}
fclose(f);
return 0; // success
}
i am having trouble in the first strcpy it is saying that i am passing the first argument of strcoy makes pointer from integer without a cast
any suggestions