diff options
author | Federico Igne <undyamon@disroot.org> | 2023-12-15 18:30:05 +0100 |
---|---|---|
committer | Federico Igne <undyamon@disroot.org> | 2023-12-19 02:05:33 +0100 |
commit | fe385ca1e5cd219478aef8f982d07182e4c8ad0d (patch) | |
tree | e4ae857c8a68824e1a189990b2de8b99b989f832 | |
parent | c23733d2882f8d0b47e3685b2ccdf899397511d8 (diff) | |
download | aoc-fe385ca1e5cd219478aef8f982d07182e4c8ad0d.tar.gz aoc-fe385ca1e5cd219478aef8f982d07182e4c8ad0d.zip |
refactor(flake): minor changes to boilerplate code generation
-rw-r--r-- | 2023/flake.nix | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/2023/flake.nix b/2023/flake.nix index 7a8ee2b..cc32737 100644 --- a/2023/flake.nix +++ b/2023/flake.nix | |||
@@ -62,12 +62,9 @@ | |||
62 | #include <iostream> | 62 | #include <iostream> |
63 | #include <fstream> | 63 | #include <fstream> |
64 | 64 | ||
65 | int main(int argc, char* argv[]) | 65 | bool parse(const char* file) |
66 | { | 66 | { |
67 | int answer{}; | 67 | if (std::ifstream input{ file }; input.is_open()) |
68 | |||
69 | std::ifstream input{ argv[1] }; | ||
70 | if (input.is_open()) | ||
71 | { | 68 | { |
72 | std::string line; | 69 | std::string line; |
73 | while (not std::getline(input,line).eof()) | 70 | while (not std::getline(input,line).eof()) |
@@ -75,7 +72,14 @@ | |||
75 | /* ... */ | 72 | /* ... */ |
76 | } | 73 | } |
77 | } | 74 | } |
78 | input.close(); | 75 | return false; |
76 | } | ||
77 | |||
78 | int main(int argc, char* argv[]) | ||
79 | { | ||
80 | int answer{}; | ||
81 | |||
82 | auto input = parse(argv[1]); | ||
79 | 83 | ||
80 | /* ... */ | 84 | /* ... */ |
81 | 85 | ||