reading from a file depending on variable
well I have been messing around with file input and output as well as trying to fix up my old text based adventure game. At the moment everythink is going well and I already have planned how I will do all my features. The issue is I have hit a problem which I am not sure how to get around with out using a cheap trick.
My idea is to load all map data from files. This will make my code alot less messy as well as meaning I won't need to hard code stuff. I have worked out how to do everythink but I am once again in need of your help. This is how I plan to do it.
1.reads from a txt the map description e.t.c
2.stores everything in variables.
3.prints the map description.
4.player can choose if he wants to move n,s,e,w
5.if the player for instance picks north it will look at the north variable (lets say its 2) and then reload all the variables from the text file called number 2.
the issue is I am having problems getting the computer to read from a file depending on the vairable name I have tried many combinations my latest has been.
ifstream readMap("C:\\Dragonways\\Map\\" << (mapfile) << ".txt");
but I have not had any luck. Any help would be really nice.
thanks for reading