ok, stripped down, this is what i use to save a player's game in my RPG:
savename is the variable for the name of the game that the player enters to save the game as. record[a] is all the different variables that are saved in the file.Code:saveinfo = fopen(savename, "w+"); if (saveinfo == NULL) { cout << "ERROR\n"; //if it can't save game produce //an error } else { //write all records to whatever they //named the file for (a=0;a<276;a++) { fprintf(saveinfo, "%i\n", record[a]); } fclose(saveinfo); } if (quicksave==0 && saveinfo!=NULL) { cout << "\nGame saved successfully.\n"; system("Pause"); }
now, my question is this: i want to save all the games in a subdirectory of where the game is saved, say in a subdir called "saves". how would i do this if i dont know the directory that the game itself will be in? because it wont always be in c:/game/...i hope that makes sense. if anyone could give me some pointers i would appreciate it. thanks!



LinkBack URL
About LinkBacks


