From e7d3cc9023be90a64631473a0dd0e4a66c95dbb6 Mon Sep 17 00:00:00 2001 From: Ben Skuppin Date: Tue, 4 Nov 2025 10:10:08 +0100 Subject: [PATCH] input.c fertig 1 --- Start_Windows/input.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/Start_Windows/input.c b/Start_Windows/input.c index 13c244f..6ea794b 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -8,21 +8,11 @@ // Read words from file and store in 'words' array int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) { - /*file = fopen("words.txt", "r"); //liest das doc ein - if (file == NULL) - return -1;*/ - FILE *ptr; + char text [2000]; char line[200]; - char value; int i = 0; - int start = 0, end= 0; - ptr = fopen("words.txt", "r"); - if (ptr == NULL) { - printf("Datei konnte nicht geöffnet werden.\n"); - return 1; - } while (fgets(line, sizeof(line), ptr)) { for (int j = 0; line[j] != '\0'&& i < sizeof(text)-1;j++) { @@ -32,9 +22,7 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) } text[i] = '\0'; - fclose(ptr); - printf("%s\n", text); //sortierung der wörter in words(unterhalb) @@ -52,9 +40,10 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) zaehler++; } + maxWordCount=zaehler; - //alle buchstaben in großbuchstaben ändern + //alle Buchstaben in Großbuchstaben ändern @@ -66,6 +55,6 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) } } - + return 0; } \ No newline at end of file