From 4e9132b983c771d3e70d5a6b8bcdfdb1fead81fa Mon Sep 17 00:00:00 2001 From: kartofen Date: Mon, 1 Aug 2022 23:44:04 +0300 Subject: some more --- Advent-of-Code-2021/AOC-16/build.sh | 7 +++++++ Advent-of-Code-2021/AOC-16/main.c | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 Advent-of-Code-2021/AOC-16/build.sh create mode 100644 Advent-of-Code-2021/AOC-16/main.c (limited to 'Advent-of-Code-2021/AOC-16') diff --git a/Advent-of-Code-2021/AOC-16/build.sh b/Advent-of-Code-2021/AOC-16/build.sh new file mode 100755 index 0000000..6be9241 --- /dev/null +++ b/Advent-of-Code-2021/AOC-16/build.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -xe + +gcc -o main -Wall -Wextra main.c + +./main diff --git a/Advent-of-Code-2021/AOC-16/main.c b/Advent-of-Code-2021/AOC-16/main.c new file mode 100644 index 0000000..baa6501 --- /dev/null +++ b/Advent-of-Code-2021/AOC-16/main.c @@ -0,0 +1,25 @@ +#include +#include + +#if 1 + #define FILE_PATH "example.txt" +#else + #define FILE_PATH "input.txt" +#endif + +void parse() +{ + FILE *fp = fopen(FILE_PATH, "r"); + if(!fp) { + fprintf(stderr, "ERROR: Could not open file: %s\n", FILE_PATH); + exit(EXIT_FAILURE); + } + + fclose(fp); +} + +int main(void) +{ + parse(); + return 0; +} -- cgit v1.2.3