From 2ae0b4b1fec92e41579cd2996265928bdafeaaa4 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Wed, 19 Apr 2023 13:21:56 -0500 Subject: [PATCH] Fixed bug with reading characters from a file --- editor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/editor.c b/editor.c index 2b52a87..c46072f 100644 --- a/editor.c +++ b/editor.c @@ -100,10 +100,9 @@ int main(int argc, char** argv) { if (argc == 2) { if (access(argv[1],F_OK) == 0) { /* If the file exists */ - FILE* file = fopen(argv[1],"r"); char c; - while (c = fgetc(file) != EOF) { + while ((c = fgetc(file)) != EOF) { buffer_insert(c,buffer); }