Update main.c

added Function for file closing
This commit is contained in:
SirTalksalot75 2024-04-22 13:41:37 +02:00 committed by GitHub
parent 4976aeb22f
commit 05d603f7ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 2 deletions

View File

@ -31,12 +31,23 @@ void setup(void)
#endif #endif
// actual setup // actual setup
DEBUG("finished starting up gemstone..."); DEBUG("finished starting up gemstone...");
} }
/**
* @brief Closes File after compiling.
*
*/
void close_file(void)
{
fclose(input);
}
int main(void) { int main(void) {
setup(); setup();
atexit(close_file);
FILE* input = fopen("program.gem", "r"); FILE* input = fopen("program.gem", "r");
@ -49,6 +60,5 @@ int main(void) {
yyparse(); yyparse();
atexit(input);
return 0; return 0;
} }