diff options
| -rw-r--r-- | timetracker.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/timetracker.c b/timetracker.c index 788c7a0..4b42d2a 100644 --- a/timetracker.c +++ b/timetracker.c @@ -9,6 +9,7 @@ void start_new_activity(); void stop_current_activity(); void print_activities(); void save_to_file(); +void load_file(); typedef struct activities { @@ -22,8 +23,8 @@ activity activities_list[100]; int main() { - - strcpy(current_activity.description,"N/A\n"); + strcpy(current_activity.description,"N/A"); + load_file(); char command; while(command != 'q') @@ -63,7 +64,7 @@ void print_current_activity() printf("==================================================" "==================================================\n" - "Current activity: %sStart time: %sDuration: %ld mins.\n" + "Current activity: %s\nStart time: %sDuration: %ld mins.\n" "==================================================" "==================================================\n", current_activity.description, ctime(¤t_activity.start_time), @@ -86,7 +87,7 @@ void print_activities() strftime(buf1, sizeof(buf1), "%a %Y-%m-%d %H:%M:%S %Z", &ts1); strftime(buf2, sizeof(buf2), "%a %Y-%m-%d %H:%M:%S %Z", &ts2); - printf("\nStart time: %s\nEnd time: %s\nActivity: %s" + printf("\nStart time: %s\nEnd time: %s\nActivity: %s\n" "--------------------------------------------------" "--------------------------------------------------", buf1, buf2, activities_list[i].description); @@ -99,6 +100,7 @@ void start_new_activity() printf("\nWhat are you doing: "); fgets(current_activity. |