diff options
author | Nick Van Doorn <vandoorn.nick@gmail.com> | 2019-06-16 20:48:45 -0700 |
---|---|---|
committer | Nick Van Doorn <vandoorn.nick@gmail.com> | 2019-06-16 20:48:45 -0700 |
commit | facaf53f7a4cc7cec1da442e4ead388ced16c81c (patch) | |
tree | 5aaa0292c5e8cb445f0021a756f12e3bf78e90b1 | |
parent | ca2ca5620d7e79730ef95c004e8543a97befa5ac (diff) |
Fix get routine
-rw-r--r-- | database.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -28,13 +28,14 @@ enum DatabaseError_t database_getEntries(const char *path, struct TimeEnty_t *ou f = fopen(filePath, "r"); if(f == NULL) goto done; while(fgets(line, 2048, f)) { - scanf(line, "%d %ld", &lineDirection, &lineTime); + sscanf(line, "%d %ld", &lineDirection, &lineTime); out[i].direction = lineDirection; out[i].datetime = lineTime; i++; } done: + fclose(f); *size = i; return DB_OK; } |