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

@ -35,8 +35,19 @@ void setup(void)
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;
}