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; }