Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include "include/yaml-cpp/yaml.h"
- int main()
- {
- YAML::Node config = YAML::LoadFile("config.yaml");
- if (config["lastLogin"]) {
- std::cout << "Last logged in: " << config["lastLogin"].as<std::string>() << "\n";
- }
- const std::string username = config["username"].as<std::string>();
- const std::string password = config["password"].as<std::string>();
- //login(username, password);
- std::cout << "logging in... (" << username << ":" << password << ")" << std::endl;
- config["lastLogin"] = "2018-06-11";
- std::ofstream fout("config.yaml");
- fout << config;
- std::cout << "[main] done!" << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement