From e99a6affae723cd4735f7504f892739508e9345b Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Tue, 1 Aug 2017 16:59:14 +0200 Subject: Save to file after stopping new activity. --- timetracker.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/timetracker.c b/timetracker.c index e99f950..dc9a922 100644 --- a/timetracker.c +++ b/timetracker.c @@ -86,8 +86,8 @@ void print_new_activity(WINDOW *win) mvwprintw(win, 1, 1, "Current activity: %s", new_activity.description); mvwprintw(win, 2, 1, "Start time: %s", start_time); mvwprintw(win, 3, 1, "Duration: %ld", (time_now - new_activity.start_time)/60); - - wrefresh(win); + + wrefresh(win); } void print_activities(WINDOW *win) @@ -127,6 +127,8 @@ void stop_new_activity() break; } } + + save_to_file(create_data_files()); } void edit_new_activity() @@ -188,4 +190,5 @@ void load_file(char *filepath) fp = fopen(filepath, "r"); while (EOF != fscanf(fp, "%ld;%ld;%s", &activities_list[i].start_time, &activities_list[i].end_time, activities_list[i].description)) i++; + fclose(fp); } -- cgit v1.2.3