From 1affb1304170ad0ef40c399f4e6b3f6d339b1e08 Mon Sep 17 00:00:00 2001 From: Hofmann Jonas Date: Fri, 31 Oct 2025 01:13:56 +0100 Subject: [PATCH] return 0 if file not found --- Start_Windows/input.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Start_Windows/input.c b/Start_Windows/input.c index 081ea34..64ad407 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -9,6 +9,12 @@ static char *singleWordBuffer; // eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt. char *readSingleWord(FILE *file) { + if (file == NULL) + { + return 0; + } + + fgets(singleWordBuffer, MAX_LINE_LEN, file); }