From d7cf85b44f5b7321895b2fd3feb7c74c6816de36 Mon Sep 17 00:00:00 2001 From: ketrptr Date: Mon, 16 Dec 2024 09:56:58 +0100 Subject: [PATCH] modified: src/ui.c --- src/ui.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ui.c b/src/ui.c index bb0af5f..d89c733 100644 --- a/src/ui.c +++ b/src/ui.c @@ -20,7 +20,6 @@ const char *dbName = "db.csv"; int main(void) { - char taskname[256]; // taskName Buffer int taskcreation_date = 0; int taskdeadline_date = 0; int taskpriority = 0; @@ -45,13 +44,16 @@ int main(void) { continue; }; + char *taskname = NULL; // taskName Buffer + size_t nameLen; switch (choice) { case 1: printf(" Geben sie das gewünschte Fach ein: \n"); + fgetc(stdin); time_t now = time(NULL); struct tm lc; localtime_r(&now, &lc); - if (fscanf(stdin, "%s", taskname) <= 0) { + if (getline(&taskname, &nameLen, stdin) < 0) { printf("Ungültige Eingabe für den Namen.\n"); return -1; }