Game und input bei mac geändert

input bei win geändert

unittests: 3 SUCCESS 2 FAIL
This commit is contained in:
2025-10-24 22:01:21 +02:00
parent 2a71e61f96
commit 713355b1ac
8 changed files with 52 additions and 115 deletions
+14 -1
View File
@@ -1,12 +1,25 @@
#include "input.h"
#include <string.h>
#include <ctype.h>
#include <stdio.h>
// 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
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
{
unsigned int count = 0;
// Solange noch Platz ist und Wörter vorhanden sind
while (count < maxWordCount && fscanf(file, "%s", words[count]) == 1) {
// Optional: alle Buchstaben in Kleinbuchstaben umwandeln
for (int i = 0; words[count][i]; i++) {
words[count][i] = tolower((unsigned char)words[count][i]);
}
count++;
}
return count; // gibt zurück, wie viele Wörter tatsächlich eingelesen wurden
}