In Myclass.cpp: const std::string FILE_NAME = "C:\\MyFileName.txt"; MyClass::MyClass() { ifstream fileToOpen; fileToOpen.open(FILE_NAME); //FILE_NAME shows "" in debug } MyClass::OpenFile() { ifstream fileToOpen; fileToOpen.open(FILE_NAME); //when called from another location, this resolves to proper file name. } I’m trying to open a file in the constructor. When I call the open function on that file name, the […]
The post const string value contents not recognized in constructor appeared first on BlogoSfera.