Reputation: 35
I have a problem with some of my functions. I want to get a member ob a struct, out of another struct. The normal call is functionel, but embedded in a function, it doesn't work. Is there any idea why and how I can solve that?
The following function is an example. It should get the time out of a struct, embedded in another struct via the time-converting function "FUN_1"
FUN_1((time_t *)&ptr_to_s_20b_parse_entries->s_28b_meta->time_c);
My structs are:
struct s_28b_meta {
int version;
__time32_t time_c;
__time32_t time_m;
uint32_t i_next;
int hash_value;
int len_database_name;
int *ptr_database_name;
};
struct s_20b_parse_entries {
int *s_28b_meta;
int *s_8b_keys;
int **a_db_entries;
size_t n_db_entries;
int i_next;
};
The decleration:
struct s_28b_meta *ptr_temp;
struct s_20b_parse_entries *ptr_to_s_20b_parse_entries;
Upvotes: 0
Views: 45
Reputation: 223917
In struct s_20b_parse_entries
, you have the s_28b_meta
field defined as int *
. This is not a pointer to struct so you can't use the ->
operator on it, which is why you're getting the error.
It should be defined as a struct s_28b_meta *
.
Upvotes: 1