I want to create a map of a key and the corresponding file in C++. I used the below snipper, which is giving mean exception at last line *m_jsTabFilesMap[key] << text;
:
std::map<std::string, std::ofstream*> m_jsTabFilesMap;
std::string text = "hello all";
std::string key = "a";
*m_jsTabFilesMap[key] << text;