Split 2025 into lang

This commit is contained in:
Jose Caban
2025-11-30 21:34:14 -05:00
parent e9ac699e67
commit 353480c75c
10 changed files with 493 additions and 493 deletions

View File

@@ -0,0 +1,42 @@
#include "AdventHelpers/InputFileHelper.h"
#include <fstream>
#include <string>
#include <iostream>
namespace AdventHelper {
// Opens file, reads each line into mLines vector. Returns null on error.
InputFileHelper* InputFileHelper::create(const char* filename) {
InputFileHelper* inputFileHelper = nullptr;
std::ifstream file(filename);
if (file.is_open()) {
inputFileHelper = new InputFileHelper();
std::string line;
while (std::getline(file, line)) {
inputFileHelper->mLines.push_back(line);
}
// Clean up
file.close();
}
else {
std::cerr << "Error: Could not open file " << filename << std::endl;
}
return inputFileHelper;
}
const char* InputFileHelper::getLine() {
return nullptr;
}
void InputFileHelper::destroy(InputFileHelper* inputFileHelper) {
if (inputFileHelper) {
delete inputFileHelper;
} else {
std::cerr << "Warning: Attempted to destroy a null InputFileHelper pointer." << std::endl;
}
}
} // namespace AdventHelper