modified: src/ui.c

bugfix
ketrptr 2024-12-16 09:56:58 +01:00
parent 2b162f532f
commit d7cf85b44f
1 changed files with 4 additions and 2 deletions

View File

@ -20,7 +20,6 @@
const char *dbName = "db.csv"; const char *dbName = "db.csv";
int main(void) { int main(void) {
char taskname[256]; // taskName Buffer
int taskcreation_date = 0; int taskcreation_date = 0;
int taskdeadline_date = 0; int taskdeadline_date = 0;
int taskpriority = 0; int taskpriority = 0;
@ -45,13 +44,16 @@ int main(void) {
continue; continue;
}; };
char *taskname = NULL; // taskName Buffer
size_t nameLen;
switch (choice) { switch (choice) {
case 1: case 1:
printf(" Geben sie das gewünschte Fach ein: \n"); printf(" Geben sie das gewünschte Fach ein: \n");
fgetc(stdin);
time_t now = time(NULL); time_t now = time(NULL);
struct tm lc; struct tm lc;
localtime_r(&now, &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"); printf("Ungültige Eingabe für den Namen.\n");
return -1; return -1;
} }