Fixed file_exists()

This commit is contained in:
Igor Schelkonogov 2015-10-25 00:22:43 +05:00
parent 4e174661ed
commit 4f898d38bb

7
text.c
View File

@ -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 */