我正在尝试将从 MySQL 查询获取的结果存储到结构数组中。不过,我似乎无法让这些类型正常工作,而且我发现 MySQL 文档很难整理。
我的结构是:
struct login_session
{
char* user[10];
time_t time;
int length;
};
我试图获取数据的循环是:
while ( (row = mysql_fetch_row(res)) != NULL ) {
strcpy(records[cnt].user, &row[0]);
cnt++;
}
无论我尝试什么,尽管我不断收到错误:
test.c:45: warning: passing argument 1 of ‘strcpy’ from incompatible pointer type
/usr/include/string.h:128: note: expected ‘char * __restrict__’ but argument is of type ‘char **’
test.c:45: warning: passing argument 2 of ‘strcpy’ from incompatible pointer type
/usr/include/string.h:128: note: expected ‘const char * __restrict__’ but argument is of type ‘MYSQL_ROW’
任何指针?