remove fclose() because it's already called in main.c

This commit is contained in:
Simon Wiesend 2025-11-02 20:28:35 +01:00
parent 0aa5c5e9e3
commit 69f9945fe0
No known key found for this signature in database
GPG Key ID: 711FA2FAE3A80C81
2 changed files with 8 additions and 8 deletions

View File

@ -13,7 +13,8 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
char buffer[MAX_WORD_LEN]; char buffer[MAX_WORD_LEN];
unsigned int count = 0; unsigned int count = 0;
if (file == NULL) { if (file == NULL)
{
return 1; return 1;
} }
@ -24,7 +25,8 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
while (token != NULL && count < maxWordCount) while (token != NULL && count < maxWordCount)
{ {
// In Großbuchstaben umwandeln // In Großbuchstaben umwandeln
for (int i = 0; token[i] != '\0'; i++) { for (int i = 0; token[i] != '\0'; i++)
{
token[i] = toupper((unsigned char)token[i]); token[i] = toupper((unsigned char)token[i]);
} }
@ -39,7 +41,5 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
} }
} }
fclose(file);
return count; return count;
} }

View File

@ -13,7 +13,8 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
char buffer[MAX_WORD_LEN]; char buffer[MAX_WORD_LEN];
unsigned int count = 0; unsigned int count = 0;
if (file == NULL) { if (file == NULL)
{
return 1; return 1;
} }
@ -24,7 +25,8 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
while (token != NULL && count < maxWordCount) while (token != NULL && count < maxWordCount)
{ {
// In Großbuchstaben umwandeln // In Großbuchstaben umwandeln
for (int i = 0; token[i] != '\0'; i++) { for (int i = 0; token[i] != '\0'; i++)
{
token[i] = toupper((unsigned char)token[i]); token[i] = toupper((unsigned char)token[i]);
} }
@ -39,7 +41,5 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
} }
} }
fclose(file);
return count; return count;
} }