summaryrefslogtreecommitdiffstats
path: root/2021/day2/pilot.c
blob: 4268cc7fa23c7be32d08fe9536e01374bcb21b4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char *argv[])
{
	if (argc != 2) {
		printf("Usage: ./depth <input-file>\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;
}