7 unsigned long int money = 0;
8 unsigned long int num_items = 0;
9 BYTE num_credit_items = 0;
10 unsigned long int items_sold = 0;
11 BYTE printer_port = 4;
12 struct status_t status[MAX_ITEMS+1];
13 struct credits_t credits[MAX_CREDIT_ITEMS+1];
23 f = fopen("items", "r");
24 for (num_items=0; num_items < MAX_ITEMS && !feof(f); num_items++) {
26 sep = strchr(line, '=');
27 strncpy(status[num_items].item_name, line, sep-line);
28 status[num_items].price = atoi(sep+1);
29 status[num_items].times_sold = 0;
35 * must be called after load_items()
42 f = fopen("state", "r");
44 printf("cannot open state\n");
49 sep = strchr(line, '=');
50 *(line + (sep-line)) = 0;
51 for (i=0; i< MAX_ITEMS; i++) {
52 if (strcmp(line, status[i].item_name)==0) {
53 status[i].times_sold = atoi(sep+1);
73 strcpy(status[0].item_name, "cola");
74 status[0].price = 230;
75 status[0].times_sold = 0;
76 strcpy(status[1].item_name, "mate");
77 status[1].price = 150;
78 status[1].times_sold = 0;
79 for (c = 2; c < MAX_ITEMS; ++c)
80 status[c].item_name[0] = 0;
84 status[0].times_sold=23;
85 status[1].times_sold=42;
94 void save_credits() {}