I am trying to update my quantity in stock which is a struct attribute saved in a file, i wish to add the order quantity which is also a struct attribute saved in a filed, I tried this line of code, but is not giving any change, could anyone give me any ideas?
fread(arrayBatch, sizeof(struct product), numberOfStructsProd, prodFile);
int k;
for(k=0; k< numberOfStructsProd; k++)
{
update = arrayBatch[k].quantityInStock + arrayBatch[k].orderQuantity;
arrayBatch[k].quantityInStock = update;
printf("Batch file updated...\n");
}
fwrite(arrayBatch, sizeof(struct product), numberOfStructsProd, prodFile);