ok. My files are properly opening now.
How can i now load this data into my structs? I want the spaces to distinguish the different fields in the struct. I was thinking of using something like the following:
The cat struct is used for holding details of categories.
The item struct is used to describe a product
typedef struct item product;
typedef struct cat category;
#define VRATES "productVat.txt"
#define VRATESpermission "r"
#define PRODUCT "products.txt"
#define PRODUCTpermission "r"
int main ()
//char buf[BUFSIZ] = "Garbage";
if ((prods = fopen(PRODUCT, "r")) == NULL)
if ((rates = fopen(VRATES, "r")) == NULL)
/* k = 0;
while (fgets(buf, sizeof(buf), rates) != NULL)
but i cant figure out how to do it like this properly. Any help appreciated!
//Product array - holds all products in the shop
//category array - used to hold the categories
//basket array holds the items they buy