master
Benjamin Kraft 3 years ago
parent 873e952780
commit adf2565729
  1. 10
      src/main.cpp

@ -3,8 +3,8 @@
#include "days/days.h" #include "days/days.h"
std::vector<std::string> getInput(int day, std::string key, bool useTestInput) { Input getInput(int day, std::string key, bool useTestInput) {
std::vector<std::string> result; Input input;
char dayStrPadded[3]; char dayStrPadded[3];
sprintf(dayStrPadded, "%02u", day); sprintf(dayStrPadded, "%02u", day);
@ -13,7 +13,7 @@ std::vector<std::string> getInput(int day, std::string key, bool useTestInput) {
if (!std::filesystem::exists({localFilePath})) { if (!std::filesystem::exists({localFilePath})) {
if (key.empty()) if (key.empty())
return result; return input;
std::string dayStr = std::to_string(day); std::string dayStr = std::to_string(day);
std::string url = "https://adventofcode.com/2021/day/" + dayStr + "/input"; std::string url = "https://adventofcode.com/2021/day/" + dayStr + "/input";
std::cout << "Input does not exist. Fetching from " + url << std::endl; std::cout << "Input does not exist. Fetching from " + url << std::endl;
@ -26,11 +26,11 @@ std::vector<std::string> getInput(int day, std::string key, bool useTestInput) {
std::string line; std::string line;
while (std::getline(file, line)) while (std::getline(file, line))
result.push_back(line); input.push_back(line);
file.close(); file.close();
return result; return input;
} }
std::string getSessionKey() { std::string getSessionKey() {

Loading…
Cancel
Save