diff options
| author | Carlos Maiolino <[email protected]> | 2025-07-10 22:55:07 +0200 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2025-07-10 22:56:55 +0200 |
| commit | d98f46ce647846b0aa30b2e16a30fd4e152a1bf5 (patch) | |
| tree | 267474fcc77cf20b428f6f4c7f768ca09f4cfe0e /C/final-project-z2h/include/parse.h | |
| parent | 869e68986aa8f69af6e7842260a68d1e5c6f796f (diff) | |
Add new code
Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'C/final-project-z2h/include/parse.h')
| -rw-r--r-- | C/final-project-z2h/include/parse.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/C/final-project-z2h/include/parse.h b/C/final-project-z2h/include/parse.h new file mode 100644 index 0000000..edcda9b --- /dev/null +++ b/C/final-project-z2h/include/parse.h @@ -0,0 +1,26 @@ +#ifndef PARSE_H +#define PARSE_H + +#define HEADER_MAGIC 0x4c4c4144 + +struct dbheader_t { + unsigned int magic; + unsigned short version; + unsigned short count; + unsigned int filesize; +}; + +struct employee_t { + char name[256]; + char address[256]; + unsigned int hours; +}; + +int create_db_header(int fd, struct dbheader_t **headerOut); +int validate_db_header(int fd, struct dbheader_t **headerOut); +int read_employees(int fd, struct dbheader_t *, struct employee_t **employeesOut); +int output_file(int fd, struct dbheader_t *, struct employee_t *employees); +void list_employees(struct dbheader_t *dbhdr, struct employee_t *employees); +int add_employee(struct dbheader_t *dbhdr, struct employee_t *employees, char *addstring); + +#endif |
