From 212bb6e46f69220e1468908a4e224c8c2b36f761 Mon Sep 17 00:00:00 2001 From: poppni99154 Date: Mon, 3 Nov 2025 10:54:35 +0100 Subject: [PATCH] =?UTF-8?q?nput=20=C3=A4nderung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Start_Windows/input.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Start_Windows/input.c b/Start_Windows/input.c index ed77805..5286715 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -1,12 +1,34 @@ #include "input.h" #include #include +#include //fürs öffnen FILE // TODO: // eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt. // Read words from file and store in 'words' array + +#define MAX_WORD_LENGTH 100 //ka ob man dass muss + + int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) { +FILE *quelle; //Zeiger auf quelle + +quelle = fopen("words.txt", "r"); //quelle definieren (Datei öffnen) + + +if (quelle==0) //Dateiöffnen geklappt? +{ + printf("File not found\n"); + return -1; +} + +fgets(words, MAX_WORD_LEN, quelle); + + + fclose(quelle); //Datei schließen + + return words; //string zurückgeben } \ No newline at end of file