#include //#include //#include #ifndef BEERBOX_IS_INCLUDED #define BEERBOX_IS_INCLUDED #define NUM_OF_PEOPLE 25 #define NUM_OF_DRINKS 10 #define DRINK_NAME_MAX_LENGTH 13 #define FILE_NAME_LEN 4 #define FILE_EXTENSION_LEN 4 #define FILE_EXTENSION "per" #define NAME_LEN 10 extern int __drinks_taken; extern int __drinks_put_in; //Beware! Only valid inside the function it has been set in! extern char tmp_filename[]; typedef struct{ /*Drink spevifier*/ char name[DRINK_NAME_MAX_LENGTH + 1]; /*Value in cents*/ int price; /*available quantity*/ int quantity; }Drink; typedef struct{ Drink drinks[NUM_OF_DRINKS]; }Beerbox; typedef struct{ char file_name[FILE_NAME_LEN + 1]; char name[NAME_LEN + 1]; int rfid_uuid; int finger_uuid; int drinks_taken[NUM_OF_DRINKS]; }Person; Beerbox* read_beerbox(Beerbox *box); Beerbox* add_drink(Beerbox *box); Person read_person(Beerbox *box, char *filename); void print_person(Beerbox *box, Person *aperson); char* read_line_from_file(FILE *stream, char *str, int max_len); char* read_from_file_until(FILE *stream, char *str, int max_len, char until); int update_pers_file(Beerbox *box, Person *aperson); #endif