Adding sales and customers to a database

Iv got some code done to try add sales and customers to files but its still not working.. i dont know where im going wrong..
Below are the 2 functions i wrote. I think i need to use an fseek or fwrite somewhere but im not sure where..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 void add_customer(void)
{
    printf("\nEnter customers ID: ");
    scanf("%d",&new_customer.id);

    printf("Enter customers firstname: ");
    scanf("%f",&new_customer.first_name);

    printf("Enter customers surname: ");
    scanf("%d",&new_customer.surname);

    printf("Enter customers age: ");
    scanf("%s*c",&new_customer.age);
    
    printf("Enter customers gender: ");
    scanf("%s*c",&new_customer.gender);
    
    printf("Enter customers address: ");
    scanf("%s*c",&new_customer.address);

    fprintf(fpnew_customer, "%d %s %s %d %s %s\n", new_sale.id,
    new_customer.first_name,
    new_customer.surname,
    new_customer.age,
    new_customer.gender,
    new_customer.address);

}

void add_sale(void)
{
    printf("\nEnter sale ID: ");
    scanf("%d",&new_sale.id);

    printf("Enter sale product_description: ");
    scanf("%f",&new_sale.product_description);

    printf("Enter sale price: ");
    scanf("%d",&new_sale.price);

    printf("Enter sale quantity: ");
    scanf("%s*c",&new_sale.quantity);

    fprintf(fpnew_sale, "%d %s %f %d\n", new_sale.id,
    new_sale.product_description,
    new_sale.price,
    new_sale.quantity);
}
Topic archived. No new replies allowed.