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
then want to read lines one by one (each line is something like page6.txt)Code:FILE* ptr_map; ptr_map=fopen("gamemap.txt","r");
that Page* current=(Page*)malloc(sizeof(Page));Code:fscanf(ptr_map,"%s",current->page);
and Page is:
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:typedef struct PAGE{ char page[10]; shape* element; struct PAGE* next; struct PAGE* previous; } Page;
see these picturesCode:FILE* ptr_page=fopen(current->page,"r");
is it correct?



LinkBack URL
About LinkBacks




