aoc2024: prepare programming environment
This commit is contained in:
9
userspace/aoc2024/day-template/CMakeLists.txt
Normal file
9
userspace/aoc2024/day-template/CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(aoc2024_day-template ${SOURCES})
|
||||
banan_include_headers(aoc2024_day-template ban)
|
||||
banan_link_library(aoc2024_day-template libc)
|
||||
|
||||
install(TARGETS aoc2024_day-template OPTIONAL)
|
||||
47
userspace/aoc2024/day-template/main.cpp
Normal file
47
userspace/aoc2024/day-template/main.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
using i8 = int8_t;
|
||||
using i16 = int16_t;
|
||||
using i32 = int32_t;
|
||||
using i64 = int64_t;
|
||||
|
||||
using u8 = uint8_t;
|
||||
using u16 = uint16_t;
|
||||
using u32 = uint32_t;
|
||||
using u64 = uint64_t;
|
||||
|
||||
i64 part1(FILE* fp)
|
||||
{
|
||||
(void)fp;
|
||||
return -1;
|
||||
}
|
||||
|
||||
i64 part2(FILE* fp)
|
||||
{
|
||||
(void)fp;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const char* file_path = "/usr/share/aoc2024/day-template_input.txt";
|
||||
|
||||
if (argc >= 2)
|
||||
file_path = argv[1];
|
||||
|
||||
FILE* fp = fopen(file_path, "r");
|
||||
if (fp == nullptr)
|
||||
{
|
||||
perror("fopen");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("part1: %" PRId64 "\n", part1(fp));
|
||||
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
|
||||
printf("part2: %" PRId64 "\n", part2(fp));
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
Reference in New Issue
Block a user