void LoadMapArea(void)
{
char ch;
int mode = ios::in;
char AreaFilename[20]= //problem here ;
fstream fin(AreaFilename, mode); //input file
while(fin.get(ch)) //read ch
{
cout<<ch; // print ch
}
fin.close(); //close file
}
this line here is the problem: char AreaFilename[20]=
well, i need to get it to = PLAYER.X.PLAYER.Y.dat.... but whatever i try i get errors because it cant convert int to char. so i need an alternative method...
any help would be great, thanks for your time!
Alan
loading/filename problem
quick question... im in the process of writing what would seem like a text engine for a text adventure or whatever it gets turned into (if anything)
i can load files ok, but just ran into a small problem....
i got a struct for PLAYER that stores player info and his/her current x and y position on the map (an array)... well when they move i need to load a file, this file needs to match where they are on the map....
so i thought that the easiet way to go about that would be creating files that have file names like this: 1.2.dat where the 1 and the 2 are the x and y pos on the map for where they load
thus, when the player moves north, i update their position on the map and then want to load the file at there new position... so basically, PLAYER.X"."PLAYER.Y".dat"
BUT, heres my file loader
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement