呵!终于解决问题了。 struct resbuf *join::strrealloc(struct resbuf *strbuf,TCHAR *word) { struct resbuf *ex; ex=entitem(strbuf,1); if(_tcslen(ex->resval.rstring)<(_tcslen(word))) //重新分配内存 ex->resval.rstring=(TCHAR *)realloc(ex->resval.rstring,_tcslen(word)+1); _tcscpy(ex->resval.rstring,word); return strbuf; } 将上面红色字语句改为: ex->resval.rstring=new TCHAR[_tcslen(word)+1]; 还应在最后一行加上:delete [_tcslen(word)+1]ex->resval.rstring; 一切ok
|