Checkpoint before working on linkedlist stuff

This commit is contained in:
2023-12-05 19:11:54 -05:00
parent 86676cae61
commit 0c23f7bf3a
6 changed files with 494 additions and 6 deletions

54
05/05.c Normal file
View File

@@ -0,0 +1,54 @@
#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;
}