高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】[求助]vs.net
[求助]vs.net
呵!终于解决问题了。
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
|