Archived

This forum has been archived. Please start a new discussion on GitHub.

Parsing the config files

All the demos come with config files. You pass the config file name when starting the application and since the demos use the ICE Application framework they get parsed through that. How do I parse the config files not using the Ice Application framework?

Comments

  • Config files are translated to properties. You can also create your own properties and load files, or populate the property set programmatically. Have a look at http://www.zeroc.com/doc/Ice-3.4.1-IceTouch/manual/Properties.31.9.html.
  • After posting this I started playing around with it. I haven't tested it yet but would something like this work?
    Ice::InitializationData initData;
    		initData.properties = Ice::createProperties();
    		initData.properties->setProperty("BuildId", string("Ice ") + ICE_STRING_VERSION);
    		initData.properties->load("config.client");
    
    		Ice::CommunicatorPtr peer = Ice::initialize(initData);
    
  • dwayne
    dwayne St. John's, Newfoundland
    That code will read the configuration file "config.client" into the initData.properties property set as well as setting the extra property "BuildId" in that property set. If that is what you want to do, the yes, this should work.