From 05d603f7ac3b48fc267ab8f9d06931750f3be7e2 Mon Sep 17 00:00:00 2001 From: SirTalksalot75 <132705706+SirTalksalot75@users.noreply.github.com> Date: Mon, 22 Apr 2024 13:41:37 +0200 Subject: [PATCH] Update main.c added Function for file closing --- src/main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index f5d242a..6617ed8 100644 --- a/src/main.c +++ b/src/main.c @@ -31,12 +31,23 @@ void setup(void) #endif // actual setup - + DEBUG("finished starting up gemstone..."); } +/** + * @brief Closes File after compiling. + * + */ + +void close_file(void) +{ + fclose(input); +} + int main(void) { setup(); + atexit(close_file); FILE* input = fopen("program.gem", "r"); @@ -49,6 +60,5 @@ int main(void) { yyparse(); - atexit(input); return 0; }