From 24466628daa055ffc80d58c862a8b66a8c11ae05 Mon Sep 17 00:00:00 2001 From: Gade Date: Tue, 27 Oct 2026 21:47:10 +0100 Subject: [PATCH 1/2] main.c ohne //a --- Startcode/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Startcode/main.c b/Startcode/main.c index caaaee5..03da755 100644 --- a/Startcode/main.c +++ b/Startcode/main.c @@ -10,7 +10,7 @@ int main(int argc, char *argv[]) { int exitCode = EXIT_SUCCESS; - //a + // Check if the correct number of arguments is provided if(argc != 2) { From 1cb18630beaef953b0afe6b9311bca00787973a0 Mon Sep 17 00:00:00 2001 From: Gade Date: Tue, 27 Oct 2026 21:51:27 +0100 Subject: [PATCH 2/2] Input Aufgaben bearbeitet --- Startcode/input.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Startcode/input.c b/Startcode/input.c index ed77805..4a706db 100644 --- a/Startcode/input.c +++ b/Startcode/input.c @@ -8,5 +8,27 @@ // Read words from file and store in 'words' array int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) { + char line[MAX_LINE_LEN]; + int count = 0; + while (fgets(line, MAX_LINE_LEN, file) != NULL && + count < maxWordCount) + { + // Zeilenumbruch entfernen + line[strcspn(line, "\n")] = '\0'; + + // Wort ins Array kopieren + strncpy(words[count], line, MAX_WORD_LEN - 1); + words[count][MAX_WORD_LEN - 1] = '\0'; + + // In Großbuchstaben umwandeln + for (int i = 0; words[count][i] != '\0'; i++) + { + words[count][i] = toupper((unsigned char)words[count][i]); + } + + count++; + } + + return count; } \ No newline at end of file