diff -ru tomatoes-1.55-orig/include/config.h tomatoes-1.55/include/config.h --- tomatoes-1.55-orig/include/config.h 2006-04-13 01:16:04.000000000 -0700 +++ tomatoes-1.55/include/config.h 2006-04-13 02:23:48.000000000 -0700 @@ -30,6 +30,10 @@ #ifndef CONFIG_H #define CONFIG_H +#include + +using namespace std; + // Config structure struct CONFIG { int vid_w; // Video mode width @@ -59,14 +63,14 @@ // config file. It first checks the user's home directory, // and if that fails it uses the CONFIG_DIR defined in the // makefile. -char *get_config_location(bool write = false); +string get_config_location(bool write = false); // Load config from file -void load_config(char *file, CONFIG *conf); +void load_config(string file, CONFIG *conf); // Save config to file -void save_config(char *file, CONFIG *conf); +void save_config(string file, CONFIG *conf); #endif diff -ru tomatoes-1.55-orig/src/config.cpp tomatoes-1.55/src/config.cpp --- tomatoes-1.55-orig/src/config.cpp 2006-04-13 01:16:04.000000000 -0700 +++ tomatoes-1.55/src/config.cpp 2006-04-13 02:30:27.000000000 -0700 @@ -76,7 +76,7 @@ // config file. It first checks the user's home directory, // and if that fails it uses the CONFIG_DIR defined in the // makefile. -char *get_config_location(bool write) { +string get_config_location(bool write) { #ifdef LINUX // Get the path to the config file string tmp = get_tomatoes_dir() + "config.cfg"; @@ -91,7 +91,7 @@ fclose(ftest); } - return (char*)tmp.c_str(); + return tmp; #endif // Return the CONFIG_DIR @@ -100,11 +100,11 @@ // Load config from file -void load_config(char *file, CONFIG *conf) { +void load_config(string file, CONFIG *conf) { - FILE *f = fopen(file, "rt"); + FILE *f = fopen(file.c_str(), "rt"); if(!f) - error_msg("Unable to load config file: %s!", file); + error_msg("Unable to load config file: %s!", file.c_str()); fscanf(f, "video_mode = %d x %d\n", &(conf->vid_w), &(conf->vid_h)); fscanf(f, "video_mode_color_depth = %d\n", &(conf->vid_color_depth)); @@ -127,11 +127,11 @@ // Save config to file -void save_config(char *file, CONFIG *conf) { +void save_config(string file, CONFIG *conf) { - FILE *f = fopen(file, "wt"); + FILE *f = fopen(file.c_str(), "wt"); if(!f) - error_msg("Unable to save config file: %s!", file); + error_msg("Unable to save config file: %s!", file.c_str()); fprintf(f, "video_mode = %d x %d\n", (conf->vid_w), (conf->vid_h)); fprintf(f, "video_mode_color_depth = %d\n", (conf->vid_color_depth));