From 4f898d38bbc2602e5d8957c8dcc4095e43c238ae Mon Sep 17 00:00:00 2001 From: Igor Schelkonogov Date: Sun, 25 Oct 2015 00:22:43 +0500 Subject: [PATCH] Fixed file_exists() --- text.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/text.c b/text.c index 0e796ae..8d0edb7 100644 --- a/text.c +++ b/text.c @@ -293,9 +293,10 @@ void save_file(PAGE *p) int file_exists(char *filename) { FILE *fp = fopen(filename, "r"); - int result = (fp == NULL); - if(result) + if(fp != NULL) { fclose(fp); - return !result; + return 1; + } + return 0; } /* saving and loading */