From 84b2e02080b5fded466e18694426d7d26db8e194 Mon Sep 17 00:00:00 2001 From: Oskar Date: Wed, 13 Dec 2023 22:51:32 +0100 Subject: fixed bug where newline was not created because the file did not end with one --- functions.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'functions.c') diff --git a/functions.c b/functions.c index c114efd..a03195d 100644 --- a/functions.c +++ b/functions.c @@ -168,7 +168,7 @@ int GET_LINE(char filename[], long focus, char **line, size_t *start) { // Makin focus--; size_t line_count = 0; // Counter starting at 0 - size_t save_i; + size_t save_i = 0; for (size_t i = 0; ; i++) { char c = fgetc(file); if (feof(file)) { // If end of file is encountered then break @@ -213,6 +213,6 @@ int GET_LINE(char filename[], long focus, char **line, size_t *start) { // Makin } -fclose(file); -return 0; + fclose(file); + return 0; } \ No newline at end of file -- cgit v1.2.3