struct userec1 { /* Structure used to hold information in */
char userid[IDLEN + 2]; /* PASSFILE */
char flags[2];
time_t firstlogin;
char lasthost[16];
unsigned int numlogins;
unsigned int numposts;
struct userec2 { /* Structure used to hold information in */
char userid[IDLEN + 2]; /* PASSFILE */
char flags; /*一些标志,戒网,版面排序之类的 */
unsigned char title; /*用户级别 */
time_t firstlogin;
char lasthost[16];
unsigned int numlogins;
unsigned int numposts;
仔细看看这里直接memcpy userec1->userec2 会有什么后果。
【 在 F1yingFish@smth.org-SPAM.no (F.Fish|人生如梦·我心依旧) 的大作中提到: 】
: 应该要加上
: bhnew.flags = bh.flags[0];
: bhnew.title = 0;
: 吧
: 【 在 atppp@bbs.stanford.edu-SPAM.no (Big Mouse) 的大作中提到: 】
: : 我ft,这样一搞不就全乱套了嘛!当然要一项一项依次赋值了。你那个结构好前面
: : 就多了一个title项,memcpy了当然就后面的项全都错位了。
: ※ 来源:·BBS 水木清华站 smth.org·[FROM: 219.224.195.*]
--
FROM 219.224.195.*