G
gladhuman
Hi,
Let's assume that I have the following structure and the following
array:
struc My_struct
{
char var_one;
char var_two;
char var_three;
};
struct My_struct testing;
char My_array[3]={43, 13, 32};
Is there a fast way of initializing the variables of "testing" with the
values of the My_array?
I would like the following
testing.var_one = 43;
testing.var_two = 13;
testing.var_three = 32;
Basically I am missing a function like fread which reads data from a
file. Instead I would like to read it from an array. Having only three
variables may not be an issue, but if the structure has 100 variables
it is a tedious work to assign the values of each array-cell to each
variable in the structure...
I appreciate your help.
Regards,
GH.
Let's assume that I have the following structure and the following
array:
struc My_struct
{
char var_one;
char var_two;
char var_three;
};
struct My_struct testing;
char My_array[3]={43, 13, 32};
Is there a fast way of initializing the variables of "testing" with the
values of the My_array?
I would like the following
testing.var_one = 43;
testing.var_two = 13;
testing.var_three = 32;
Basically I am missing a function like fread which reads data from a
file. Instead I would like to read it from an array. Having only three
variables may not be an issue, but if the structure has 100 variables
it is a tedious work to assign the values of each array-cell to each
variable in the structure...
I appreciate your help.
Regards,
GH.