| 31 | } |
| 32 | |
| 33 | long INIReader::GetInteger(const string& section, const string& name, long default_value) const |
| 34 | { |
| 35 | string valstr = Get(section, name, ""); |
| 36 | const char* value = valstr.c_str(); |
| 37 | char* end; |
| 38 | // This parses "1234" (decimal) and also "0x4D2" (hex) |
| 39 | long n = strtol(value, &end, 0); |
| 40 | return end > value ? n : default_value; |
| 41 | } |
| 42 | |
| 43 | double INIReader::GetReal(const string& section, const string& name, double default_value) const |
| 44 | { |