//loads configuration from file #include using namespace std; #include #include #include #include "define.h" #include "si_string.h" #include "si_system.h" int load_hash( map &data, string fname, string aname ) { PACKFILE *fp; char buff[MAX_LINE_LENGTH]; int p; string s,a,b; //converts name to datafile syntax s = fname; s += "#"; s += aname; fp = pack_fopen(s.c_str(),"rb"); if(!fp) { error("Unable to open hash file %s %s", fname.c_str(), aname.c_str()); return ERROR_NO_HASH_FILE; } while(pack_fgets(buff, MAX_LINE_LENGTH - 1, fp)) { // chop(buff); Allegro sa chova inak pri fgets s = buff; if(check_syntax(s)) { p = s.find('='); a = remove_spaces(s.substr(0,p)); b = remove_spaces(s.substr(p+1, s.length())); data[a] = b; } } pack_fclose(fp); return NO_ERROR; }