Files
AdventOfCode2023/05/05.c

54 lines
980 B
C

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include "llist.h"
#define DEFAULT_FILE "input.txt"
#define STRBUF_LEN 200
#define ISDIGIT(X) (X >= '0' && X <= '9')
uint64_t parse_digit(char *str);
linked_list parse_seeds(char *str)
{
linked_list seeds;
ll_init(&seeds);
while (!ISDIGIT(str)) str++;
while (*str != '\n')
{
uint64_t seed = parse_digit(str);
}
}
int main(int argc, char **argv)
{
// Get filename as an argument, if there is one
char *path = (argc > 1) ? argv[1] : DEFAULT_FILE;
if (!path)
{
printf("Requires input file.\n");
return 1;
}
FILE *file = fopen(path, "r");
char strbuf[STRBUF_LEN] = {0};
if (!file)
{
printf("Could not find file.");
return 1;
}
while (fgets(strbuf, STRBUF_LEN, file))
{
// Code goes here
}
return 0;
}