I am programming in visual studio 2010 and
want to read some text files (page1.txt page2.txt ...)(that each has some characters and numbers),that their names are in the other text file(gamemap.txt)
at first i open gamemap.txt
Code:
FILE* ptr_map;
ptr_map=fopen("gamemap.txt","r");
then want to read lines one by one (each line is something like page6.txt)
Code:
fscanf(ptr_map,"%s",current->page);
that Page* current=(Page*)malloc(sizeof(Page));
and Page is:
Code:
typedef struct PAGE{
char page[10];
shape* element;
struct PAGE* next;
struct PAGE* previous;
} Page;
after reading the first line i want to put(or copy)this string in an array that is belong to a structure and then open the corresponding text file and then read it.
Code:
FILE* ptr_page=fopen(current->page,"r");
see these pictures
is it correct?