From 2d6643732438de68217e6406f500136da2fc4a18 Mon Sep 17 00:00:00 2001 From: Giorgi Kesidis Date: Fri, 24 Oct 2025 13:59:35 +0200 Subject: [PATCH] input funktion stand 24.10 --- Start_Windows/input.c | 27 ++++++++++++++++++++++++++- Start_Windows/main.c | 2 +- Start_Windows/wordsalad_initial.exe | Bin 1117490 -> 1117490 bytes 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Start_Windows/input.c b/Start_Windows/input.c index ed77805..7bbe95a 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -8,5 +8,30 @@ // Read words from file and store in 'words' array int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) { + //kein fopen und close nötig, weil dies schon in der main passiert und mit *file übergeben wird// + -} \ No newline at end of file +if (!file) +{ + perror("Error invalid pointer to file"); + return -1; +} + +char line[1024]; +unsigned int count = 0; + +while (fgets(line, sizeof(line), file) && count < maxWordCount) +{ + line[strcspn(line, "\n")] = '\0'; + + char *token = strtok(line, " ;,"); +while (token && count < maxWordCount) +{ + strcpy(words[count], token); + count++; + token = strtok(NULL, " ;,"); +} + +} +return count; +} diff --git a/Start_Windows/main.c b/Start_Windows/main.c index bc48730..dfbf11f 100644 --- a/Start_Windows/main.c +++ b/Start_Windows/main.c @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) } else { - startGame(wordSalad, SALAD_SIZE, words, placedWords, 800); + startGame(wordSalad, SALAD_SIZE, words, placedWords, 1024); } } else diff --git a/Start_Windows/wordsalad_initial.exe b/Start_Windows/wordsalad_initial.exe index d06efb39ae2aec11404bb5ccf8db897125c3e71f..339a53c29524b4fad3717ba0a1ef63d4d5f1cda7 100644 GIT binary patch delta 72 zcmV~$yA6Xd06;P)I#fTmDINNC0tBEL^}j4S&mFf8Avp<)i85k@xJ2!8?F~xux Y=J>$^ORTWQ23zc~#{oy29_PJ#0fTfP3IG5A