举个例子,结构体RankData的结构如下:
struct RankData
{
unsigned int starnum;
char starnumtime[21];
unsigned int poetrynum;
char poetrynumtime[21];
unsigned int wordnum;
char wordnumtime[21];
unsigned int achievenum;
char achievenumtime[21];
unsigned int fforder;
char ffordertime[21];
char stuff[0];
RankData()
{
memset(starnumtime, 0, sizeof(starnumtime));
memset(poetrynumtime, 0, sizeof(poetrynumtime));
memset(wordnumtime, 0, sizeof(wordnumtime));
memset(achievenumtime, 0, sizeof(achievenumtime));
memset(ffordertime, 0, sizeof(ffordertime));
}
};
现要求实现一个函数
bool CRankList::UpdateRankList(unsigned int accid, const RankData rankdata)
,根据传进来的rankdata来更新数据库,如果xxxnum不等于0则更新数据库中对应的xxxnum以及xxxnumtime字段。
如上所示,结构体中有五个int行的num变量,五个对应的numtime字符串,如果只传了s