logical IniFile :: Refresh ( ) { logical term = NO; Initialize(); LocateSection(section_name); return(term); }
long GetInitLong(const char *Section, const char *Key, long Default, LISTPTR Input) { LISTPTR SectionHead = NULL; char Buffer[BUFSIZE + 1]; char *EndPtr = NULL; long Entry; if ((SectionHead = LocateSection(Section, Input)) == NULL) return Default; if (!LocateKey(Key, Buffer, SectionHead))return Default; Entry = strtol(Buffer, &EndPtr, 0); if (EndPtr == Buffer) return Default; return Entry; }
IniFile :: IniFile (IniFile &inifile ) : max_len(), ini_string(NULL), section(NULL), variable_string(255) { strcpy(file_name,inifile.get_file_name()); Initialize(); LocateSection(inifile.get_section_name()); }
unsigned long GetInitString(const char *Section, const char *Key, const char *Default, char *ReturnBuffer, unsigned long BufferSize, LISTPTR Input) { LISTPTR SectionHead = NULL; if ((SectionHead = LocateSection(Section, Input)) == NULL) { strncpy(ReturnBuffer, Default, BufferSize); return (unsigned long) strlen(ReturnBuffer); } //Returnbuffer contains variable value if (!LocateKey(Key, ReturnBuffer, SectionHead)) { strncpy(ReturnBuffer, Default, BufferSize); return (unsigned long) strlen(ReturnBuffer); } return (unsigned long) strlen(ReturnBuffer); }
double GetInitDouble(const char *Section, const char *Key, double Default, LISTPTR Input) { LISTPTR SectionHead = NULL; char Buffer[BUFSIZE + 1]; char *EndPtr = NULL; double Entry; if ((SectionHead = LocateSection(Section, Input)) == NULL) { return Default; } if (!LocateKey(Key, Buffer, SectionHead)) { return Default; } Entry = strtod(Buffer, &EndPtr); if (EndPtr == Buffer) { return Default; } return (Entry); }