From 5232636f79e7a5171655ccd9bd7cf816da3b3243 Mon Sep 17 00:00:00 2001 From: luis Date: Tue, 4 Nov 2025 10:51:22 +0100 Subject: [PATCH 1/2] input . c fix --- Start_Windows/input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Start_Windows/input.c b/Start_Windows/input.c index 0353aaa..6fc4a26 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -30,7 +30,7 @@ int readWords(FILE* file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) while (token != NULL && count < maxWordCount) { 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); words[count][MAX_WORD_LEN - 1] = '\0'; count++; @@ -41,5 +41,5 @@ int readWords(FILE* file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) if (shouldClose)fclose(file); - return(int)count; + return (int)count; } From cd48b739c1a714268b94956ec0fe66c5280f401c Mon Sep 17 00:00:00 2001 From: luis Date: Tue, 4 Nov 2025 11:38:24 +0100 Subject: [PATCH 2/2] input . c delimiter fix --- CMakeLists.txt | 5 +++-- Start_Windows/input.c | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91f49d1..471658c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,8 +16,9 @@ add_executable(info2Praktikum_Wortsalat Start_Windows/graphicalGame.c Start_Windows/input.c Start_Windows/main.c - # Start_Windows/unity/unity.c -) + Start_Windows/unity/unity.c + Start_Windows/unit_tests.c + ) # Link static libraries target_link_libraries(info2Praktikum_Wortsalat diff --git a/Start_Windows/input.c b/Start_Windows/input.c index 6fc4a26..15810eb 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -24,13 +24,15 @@ int readWords(FILE* file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) } 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) { - for (char* p = token; *p; ++p) + for (char *p = token; *p; ++p) *p = (char)toupper((unsigned char)*p); + strncpy(words[count], token, MAX_WORD_LEN - 1); words[count][MAX_WORD_LEN - 1] = '\0'; count++;