#include "task.h" #include using namespace std; vector > readFile(const string &filename) { vector > instructions; ifstream file(filename); if(!file.is_open()) { cerr << "Fehler: Datei " << filename << " konnte nicht geöffnet werden.\n"; return instructions; } string line; while (getline(file, line)) { // Entferne führende oder trailing Whitespace if (line.empty()) continue; istringstream iss(line); string command; string param; if (!(iss >> command)) { // Keine gültige Eingabe in dieser Zeile continue; } // Optionalen Parameter einlesen, falls vorhanden if (!(iss >> param)) { // Kein Parameter vorhanden param = ""; } instructions.push_back(make_pair(command, param)); } return instructions; } // Beispiel zur Nutzung int main() { auto result = readFile("init"); for (const auto &inst : result) { cout << "Befehl: " << inst.first << " | Parameter: " << inst.second << "\n"; } return 0; }