diff options
Diffstat (limited to 'src/ConfigReader/ConfigReader.cpp')
-rw-r--r-- | src/ConfigReader/ConfigReader.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/ConfigReader/ConfigReader.cpp b/src/ConfigReader/ConfigReader.cpp new file mode 100644 index 0000000..7589d6a --- /dev/null +++ b/src/ConfigReader/ConfigReader.cpp @@ -0,0 +1,25 @@ +/* + * ConfigReader.cpp + * + * Created on: 18.04.2016 + * Author: Tobias Frust (t.frust@hzdr.de) + */ + +#include <iostream> +#include <iomanip> +#include <cstdlib> + +#include "ConfigReader.h" + +ConfigReader::ConfigReader(const char* configFile) { + try { + cfg.readFile(configFile); + } catch (const libconfig::FileIOException &fioex) { + std::cerr << "I/O error while reading file." << std::endl; + exit(1); + } catch (const libconfig::ParseException &pex) { + std::cerr << "Parse error at " << pex.getFile() << ":" << pex.getLine() + << " - " << pex.getError() << std::endl; + exit(1); + } +} |