Using getline is the right approach. However you need to split the string into key and value before you can insert them into a map. The string class has functions find and substr.
I tried a similar method using the >> operator, but robustness is an issue. Sometimes the output isn't correct for reasons unknown. Some values for the key have unicode characters, not sure if this is the problem. I was half thinking of using regex along with this method, but it got way over my head for now haha.
@Thomas1965:
find and substr looks interesting. Will take a look at it, thanks for the tip ! :)
Executes a statement repeatedly, until the value of condition becomes false
so in this case, condition is inFile and it is true if none of the stream's flags (badbit, eofbit, failbit) is set: http://en.cppreference.com/w/cpp/io/basic_ifstream (see here for the flags and what they mean)
@gunnerfunner
Thanks for the reply, from the reference, is the operatorbool under member functions of basic_ios referring to the true/false result of ifstream ?