I'm stuck on a problem here. Kinda long...
We're inputting from a file, one line at a time, into a character array (char input[191]).
in line there are 5 key fields and then 3 fields that repeat 10 times. I have everything setup in a struct with a few unions.
I need to setup an index for each field and would like to put it in the struct. See below...
However, I can't seem to figure out how to put the offset variable into the struct without screwing up the the initial array.
Here's the code for the struct:
struct
{
int byte_offset[10];
union
{
char input[191];
union
{
struct
{
char trans_code[2];
char emp_id[10];
char date[7];
char clk_in[6];
char clk_out[6];
struct
{
char qty[4];
char invent_no[7];
char dev_no[5];
}repeat[10];
}time_card;
struct
{
char del_trans_code[2];
char key_data[45];
char repeating[144];
}output;
};
}rec;
}record;
Please help!
Thanks
Michael
We're inputting from a file, one line at a time, into a character array (char input[191]).
in line there are 5 key fields and then 3 fields that repeat 10 times. I have everything setup in a struct with a few unions.
I need to setup an index for each field and would like to put it in the struct. See below...
However, I can't seem to figure out how to put the offset variable into the struct without screwing up the the initial array.
Here's the code for the struct:
struct
{
int byte_offset[10];
union
{
char input[191];
union
{
struct
{
char trans_code[2];
char emp_id[10];
char date[7];
char clk_in[6];
char clk_out[6];
struct
{
char qty[4];
char invent_no[7];
char dev_no[5];
}repeat[10];
}time_card;
struct
{
char del_trans_code[2];
char key_data[45];
char repeating[144];
}output;
};
}rec;
}record;
Please help!
Thanks
Michael