From 736823f313bd2e00e49a1b52aaf0ea68a79db438 Mon Sep 17 00:00:00 2001 From: Vincent Douillet Date: Fri, 3 Dec 2021 17:01:37 +0100 Subject: improve input handling & merge part 1 and 2 for the first days --- input.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'input.h') diff --git a/input.h b/input.h index 9e6762e..6507053 100644 --- a/input.h +++ b/input.h @@ -1,7 +1,22 @@ -size_t count_lines(FILE* file); +#ifndef DEF_INPUTH +#define DEF_INPUTH -int read_lines_as_int(FILE* file, int* result, int resultSize); +struct input_int { + size_t line_count; + int* lines; +}; -int read_lines_as_string(FILE* file, char** result, int resultSize); +struct input_str { + size_t line_count; + char** lines; +}; -void free_strings(char** strings, size_t stringCount); +void input_int_read(struct input_int* result, char* filename); + +void input_str_read(struct input_str* result, char* filename); + +void input_int_free(struct input_int* input); + +void input_str_free(struct input_str* input); + +#endif -- cgit v1.2.3