Merge remote-tracking branch 'origin/main'

This commit is contained in:
Nils Kuebler 2025-11-04 11:39:59 +01:00
commit 58c9e7b321
2 changed files with 10 additions and 7 deletions

View File

@ -16,8 +16,9 @@ add_executable(info2Praktikum_Wortsalat
Start_Windows/graphicalGame.c Start_Windows/graphicalGame.c
Start_Windows/input.c Start_Windows/input.c
Start_Windows/main.c Start_Windows/main.c
# Start_Windows/unity/unity.c Start_Windows/unity/unity.c
) Start_Windows/unit_tests.c
)
# Link static libraries # Link static libraries
target_link_libraries(info2Praktikum_Wortsalat target_link_libraries(info2Praktikum_Wortsalat

View File

@ -24,13 +24,15 @@ int readWords(FILE* file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
} }
shouldClose = 1; shouldClose = 1;
} }
while (fgets(words[count], MAX_WORD_LEN, file) != NULL && count < maxWordCount) char line[MAX_LINE_LEN];
while (fgets(line, sizeof(line), file) != NULL && count < maxWordCount)
{ {
char* token = strtok(words[count], delimiter); char *token = strtok(line, delimiter);
while (token != NULL && count < maxWordCount) while (token != NULL && count < maxWordCount)
{ {
for (char* p = token; *p; ++p) for (char *p = token; *p; ++p)
p* = (char)toupper((unsigned char)*p); *p = (char)toupper((unsigned char)*p);
strncpy(words[count], token, MAX_WORD_LEN - 1); strncpy(words[count], token, MAX_WORD_LEN - 1);
words[count][MAX_WORD_LEN - 1] = '\0'; words[count][MAX_WORD_LEN - 1] = '\0';
count++; count++;
@ -41,5 +43,5 @@ int readWords(FILE* file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
if (shouldClose)fclose(file); if (shouldClose)fclose(file);
return(int)count; return (int)count;
} }