[window] title = My Ogre Application width = 800 height = 600 [resource] data_folder = ./data
#includeIn this example, we use the section.hasMoreElements() method to check if there are more sections in the configuration file. We also use the section.peekNextKey() method to get the name of the current section without advancing the iterator. The cpp Ogre.configfile library is part of the Ogre engine.Ogre::ConfigFile configFile; configFile.load("myconfig.cfg"); // Iterate over the sections in the configuration file Ogre::ConfigFile::SectionIterator section = configFile.getSectionIterator(); while (section.hasMoreElements()) { // Get the current section name Ogre::String sectionName = section.peekNextKey(); // Get the properties in the current section Ogre::ConfigFile::SettingsMultiMap& properties = section.getNext(); // Iterate over the properties in the section for (Ogre::ConfigFile::SettingsMultiMap::iterator it = properties.begin(); it != properties.end(); ++it) { Ogre::String propertyName = it->first; Ogre::String propertyValue = it->second; // Do something with the property std::cout << "Section: " << sectionName << ", Property: " << propertyName << ", Value: " << propertyValue << std::endl; } }