Checkpoint before working on linkedlist stuff
This commit is contained in:
54
05/05.c
Normal file
54
05/05.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user