summaryrefslogtreecommitdiff
path: root/functions.c
diff options
context:
space:
mode:
authorOskar <[email protected]>2023-12-13 22:51:32 +0100
committerOskar <[email protected]>2023-12-13 22:51:32 +0100
commit84b2e02080b5fded466e18694426d7d26db8e194 (patch)
treeebc7387760175f8d8b6615ebeda0ab4f6b4eeb95 /functions.c
parent754f7875bec4bf60d7bb8c23a588c32de255d038 (diff)
fixed bug where newline was not created because the file did not end with one
Diffstat (limited to 'functions.c')
-rw-r--r--functions.c6
1 files changed, 3 insertions, 3 deletions
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