hello, i am writing a payroll system or a attempt at it anyway. i have put in records in the system via a addrecords function then when to edit it, i want the user to be able to see which record they will be changing after choosing the number to edit, I am very new to programming, just looking for some advice for this.
heres the code for the part of the edit function i have a problem with excluding the rest of the program
Code:
printf("Enter record number to be editted\n");
scanf("%d", &employee.num);
//moving file pointer to position of record user requested
fseek(writeptr, (employee.num-1) * sizeof(struct employee_data), SEEK_CUR);
fscanf(writeptr, "%-10d%-15s%-15s%-12d%-12.2lf%-8d%-12.2lf%-12.2lf%-12.2lf%-12.2lf%-14.2lf%-12.2lf\r\n" , employee.num, employee.first_name, employee.last_name, employee.id_number, employee.pay_rate,
employee.year, employee.sthours, employee.one_and_half_hour, employee.double_hour, employee.gross_pay, employee.deductions, employee.net_pay);
printf("%-10s%-15s%-15s%-12s%-10s%-10s%-12s%-12s%-12s%-12s%-14s%-12s\r\n", "number", "First name", "Last name", "id no.", "pay rate",
"year", "sthours", "1.5 hours", "2x hours", "Gross pay", "deductions", "net Pay");
printf("%-10d%-15s%-15s%-12d%-12.2lf%-8d%-12.2lf%-12.2lf%-12.2lf%-12.2lf%-14.2lf%-12.2lf\r\n" , employee.num, employee.first_name, employee.last_name, employee.id_number, employee.pay_rate,
employee.year, employee.sthours, employee.one_and_half_hour, employee.double_hour, employee.gross_pay, employee.deductions, employee.net_pay);
the problem is that it reads the records from the file and then prints it to the screen but it does not print the last and first name , it prints all the only numerical fields. it writes the information fine to the file with the first and last name there but not when reading from file. Can anyone help me with this? if needed i can upload the entire code so you can look through it or the entire edit function but it is pretty long...
thanks in advance.