Shows how to use xtd::consiguration::file_settings object.
#include <xtd/configuration/file_settings>
#include <xtd/console>
auto write_file_settings() {
file.
top_file_comment(
"Settings file used by file_settings example.\nCopyright (c) 2024 Gammasoft. All rights reserved.");
file.write("auto_close", true);
file.write("caption", "file_settings example");
file.write("Thread \"Process\"", "timeout", 100_ms);
file.save();
}
auto reset_file_settings() {
}
auto read_file_settings() {
console::write_line("----------------------------------------");
console::write_line("\"exemple.ini\" file content :");
console::write_line(file.to_string());
console::write_line("----------------------------------------");
console::write_line("read keys :");
console::write_line("auto_close = {}", file.read("auto_close", false));
console::write_line("caption = {}", file.read("caption", "example"));
console::write_line("Thread \"Process\"", "time_out = {}", file.read("timeout", 50_ms));
console::write_line("----------------------------------------");
}
auto main() -> int {
write_file_settings();
read_file_settings();
}
Represents an object for storing and retrieving configuration information using text files in INI for...
Definition file_settings.h:32
xtd::string top_file_comment() const noexcept
Gets top file comment text.
void reset()
Reset current settings.
Contains the types that provide the programming model for handling configuration data.
Definition file_settings.h:17
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10