Advertisement
Guest User

Untitled

a guest
Jun 11th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <fstream>
  2. #include <iostream>
  3. #include "include/yaml-cpp/yaml.h"
  4.  
  5.  
  6. int main()
  7. {
  8. YAML::Node config = YAML::LoadFile("config.yaml");
  9.  
  10. if (config["lastLogin"]) {
  11. std::cout << "Last logged in: " << config["lastLogin"].as<std::string>() << "\n";
  12. }
  13.  
  14. const std::string username = config["username"].as<std::string>();
  15. const std::string password = config["password"].as<std::string>();
  16. //login(username, password);
  17. std::cout << "logging in... (" << username << ":" << password << ")" << std::endl;
  18. config["lastLogin"] = "2018-06-11";
  19.  
  20. std::ofstream fout("config.yaml");
  21. fout << config;
  22.  
  23. std::cout << "[main] done!" << std::endl;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement