diff --git a/src/code.hpp b/src/code.hpp index 4857a9e..45ff8cb 100644 --- a/src/code.hpp +++ b/src/code.hpp @@ -1,3 +1,3 @@ #include "types.hpp" -int translateCommand(std::string&, Command); +int translateCommand(std::string&, const std::string, Command); diff --git a/src/main.cpp b/src/main.cpp index 847428f..aeb60d9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,8 +10,8 @@ int process(std::string source) { std::ifstream ifs(source); - std::string out = source.substr(0, source.find_last_of('.')) + ".asm"; - std::ofstream ofs(out); + std::string filename = source.substr(0, source.find_last_of('.')); + std::ofstream ofs(filename + ".asm", std::ofstream::trunc); std::string line; std::string output; @@ -31,7 +31,7 @@ int process(std::string source) { for (const Command &cmd : commands) { int translateResult; - if ((translateResult = translateCommand(output, cmd)) != 0) { + if ((translateResult = translateCommand(output, filename, cmd)) != 0) { return translateResult; }