sorry about all the post but at least on my computer it is looking really weird, third times a charm
after sending a string to my main struct it wont allow me to print what is in the struct outside of the function in which i assigned it.
Code:
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
}
void runGame(struct Room list[]){
char input;
printf("Welcome to the Haunted Mansion!\n");
printf("Type c for current room, n/e/w/s for north/east/west/south.\n> ");
printf("%s", Room->list->id);
}
why wont it print out what is in the struct, it just ends the program as if the command wasnt there