From ce9b9c411bd6c36d80fe6dd8112c8188661e2844 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Mon, 6 Dec 2021 20:36:43 +0300 Subject: 2021, day2: start --- 2021/day2/pilot.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 2021/day2/pilot.c (limited to '2021/day2/pilot.c') diff --git a/2021/day2/pilot.c b/2021/day2/pilot.c new file mode 100644 index 0000000..4268cc7 --- /dev/null +++ b/2021/day2/pilot.c @@ -0,0 +1,34 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + if (argc != 2) { + printf("Usage: ./depth \n"); + exit(EXIT_FAILURE); + } + + FILE *fp; + char *buffer; + ssize_t read; + size_t len = 0; + + fp = fopen(argv[1], "r"); + if (fp == NULL) { + perror("fopen"); + exit(EXIT_FAILURE); + } + + int scalar; + char *way; + while ((read = getline(&buffer, &len, fp)) != -1) { + sscanf(buffer, "%s %d", way, &scalar); + // printf("READ: <%s>, <%d>\n", way, scalar); + + if (strncmp(buffer, "forward", strlen(buffer))) { + } + } + + return 0; +} -- cgit v1.2.3-70-g09d2