User Tools

Site Tools


tools:config

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tools:config [2017/12/14 08:01] graftools:config [2018/01/12 09:28] graf
Line 13: Line 13:
       add("id", a);       add("id", a);
       add("offset", b);       add("offset", b);
-      add("init values", c);+      add("initValues", c);
       add("ip", d);       add("ip", d);
   }   }
Line 24: Line 24:
  
 When such a configuration class object is created, its values are initialized with default values.  When such a configuration class object is created, its values are initialized with default values. 
 +<code cpp>
 +  TestConfig configFile("config.txt"); // choose an appropriate path
 +</code>
 +However, if a configuration file exists at the given location, you can load the values from there and overwrite these default values with the values given in the file.
 +<code cpp>
 +  TestConfig configFile("config.txt"); // choose an appropriate path
 +  configFile.load();
 +</code>
 +WARNING Valid name for the identifiers of the values include numbers and letters only, no spaces, underlines or dots. 'myText10' is valid while 'my_text_10' is not! \\ \\
 +You can manually create a suitable configuration file at the given location, e.g.
 +<code>
 +id = 1
 +offset = 2.200000
 +initValues = 0.1, 0.4, 0.3
 +ip = 127.0.0.0
  
 +</code>
 +or you could save the values of your configuration class object into the file (and possible change an existing content).
 +<code cpp>
 +  configFile.save();
 +</code>
 +It's also possible to save to or restore from another file by writing:
 +<code cpp>
 +  configFile.save("config2.txt");
 +  configFile.load("config2.txt");
 +</code>
tools/config.txt · Last modified: 2020/12/03 12:01 by ursgraf