22 lines
768 B
C
22 lines
768 B
C
#ifndef STORE_H
|
|
#define STORE_H
|
|
|
|
#include "list.h"
|
|
|
|
/*
|
|
* Text-file persistence (Milestone 4). One record per line, '|' delimiter:
|
|
* name|field1|field2
|
|
* The delimiter is safe for all three flavors (email/phone, assignment/score,
|
|
* category/amount never contain '|'); names may contain spaces.
|
|
*/
|
|
|
|
/* Write the whole list to path. Returns 0 on success, a negative status_t
|
|
(STATUS_ERR_IO / STATUS_ERR_ARG) on failure. */
|
|
int store_save(const list_t *l, const char *path);
|
|
|
|
/* Read records from path, APPENDING into *l. Returns the number of records
|
|
read (>= 0) on success, or a negative status_t on failure. Blank lines are
|
|
skipped. Fields are never NULL after a successful load. */
|
|
int store_load(list_t **l, const char *path);
|
|
|
|
#endif /* STORE_H */
|