Does anyone knows how to assigned directly the sqlite query result to a struct in C rather that assigning to its members one by one?
I have a table user_info with fields user_id, username, password. Also I have a struct st_user_info.

typedef struct st_user_info{
     int userId;
     char* userName;
     char* password;
} T_USERINFO;
T_USERINFO tUserInfo[10];

I want my query result from sqlite3_step to be assigned direcly to the struct tUserInfo[index]. Is there a way
to achieve on this way?

No. Memory for those pointers in the structure has to be allocated, and the amount of memory to allocate won't be known until you get the results of the query. sqLite won't do that for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.