Read a Config Value
mediumQuestion 591A configuration file holds one key=value pair per line with no spaces around the =:
host=localhost port=8080 debug=true
Write a function string getValue(const string& filename, const string& key) that returns the value whose key matches key exactly (the whole text before the =), or the string not found if no line has that key. For the file above, getValue(..., "port") returns 8080 and getValue(..., "user") returns not found.
The test prints the returned string on its own line, for example (see Expected Output).
Do NOT write a main function.
Expected output
8080 not found
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
Streamsifstream
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.