From cddfd5ec5e6b5c08e39d05ee55ec92600395455d Mon Sep 17 00:00:00 2001 From: fdai7492 Date: Tue, 30 Jan 2024 23:11:07 +0000 Subject: [PATCH] UserInput fix damit \n ignoriert wird, Anton Lohrey --- src/Input.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Input.c b/src/Input.c index aa44d91..1173a22 100644 --- a/src/Input.c +++ b/src/Input.c @@ -9,5 +9,9 @@ char* getUserInput() { printf("Ihre Eingabe: "); getline(&input, &size, stdin); + size_t len = strlen(input); + if (len > 0 && input[len - 1] == '\n') { + input[len - 1] = '\0'; + } return input; }