Replaced FILE* by istream in inireader
MODIFY
src/inireader.cpp
src/inireader.cpp
#include <algorithm>
#include <cctype>
#include <cstdlib>
+#include <fstream>
#include "ini.h"
#include "inireader.h"
@@ -42,6 +43,13 @@ INIReader::INIReader(const string& filename)
_error = ini_parse(filename.c_str(), ValueHandler, this);
}
+INIReader::INIReader(std::istream& filestream)
+{
+ std::ifstream filestream(filename, std::ios::ios_base::in);
+ _error = ini_parse(filestream, ValueHandler, this);
+ filestream.close();
+}
+
int INIReader::ParseError() const
{
return _error;

MODIFY
src/inireader.h
src/inireader.h
@@ -43,6 +43,11 @@ public:
// Construct INIReader and parse given filename. See ini.h for more info
// about the parsing.
INIReader(const std::string& filename);
+ /**
+ * Construct INIReader and parse given filename. See ini.h for more info
+ * about the parsing.
+ */
+ INIReader(std::istream& filestream);
// Return the result of ini_parse(), i.e., 0 on success, line number of
// first error on parse error, or -1 on file open error.

Replaced FILE* by istream in inireader