hi, hope someone can shed some light on this for me, I'm a bit stumped at the moment.
Writing a prog to read records from a binary file into memory using malloc() thenh sort them using q sort.
record structures are as follows.......
struct ir_record {
char rec_type;
char cust_code[6];
char p_num[7];
char ir_quantity[5];
};
struct d_record {
char rec_type;
char cust_code[6];
};
struct c_record {
char rec_type;
char cust_code[6];
char cust_name[21];
char cust_addr[61];
char cust_bal[10];
char limit[8];
};
union records {
struct ir_record issue_receipt;
struct d_record deletion;
struct c_record creation;
};
the records must be sorted first by cust_code and then any with the same code must be sorted so that the c_record comes last.
can anyone show me how to write the 2 comparison functions needed to perfrom this sort????
Colin.