[求助]请各位帮忙查找程序错误.
<p>我编制了一个文字连接程序,编译链接均正常,但在CAD调入运行时出现严重错误,造成系统崩溃,请各位帮忙查找错误.</p><p>//====连接文字=======================================================<br/>void join::jointxt(ads_name text,ads_name text1)<br/>{<br/> struct resbuf *la,*ed,*ep;<br/> TCHAR textstr,textstr1,tmp,tmp1,*txt=_T(""),*txt1=_T("");//*txt=new TCHAR,*txt1=new TCHAR;<br/> ads_real textrz,dist;<br/> ads_point pick,p1,p2,pt1,pt2,pp;<br/> int len,len1;</p><p> ed=acdbEntGet(text1); //取得后续实体参数集<br/> la=entitem(ed,1); //获得文本串的内容<br/> _tcscpy(textstr1,la->resval.rstring);<br/> ed=acdbEntGet(text); //取得基准实体参数集<br/> la=entitem(ed,1); //获得文本串的内容<br/> _tcscpy(textstr,la->resval.rstring);<br/> acedTextBox(ed,pt1,pt2);<br/> la=entitem(ed,10); //获得文本的插入点<br/> pick=la->resval.rpoint;<br/> pick=la->resval.rpoint;<br/> la=entitem(ed,50); //获得文本的旋转角度<br/> textrz=la->resval.rreal;<br/> len=_tcslen(textstr);<br/> len1=_tcslen(textstr1);<br/> if(len<1001 && len1<1001)<br/> {<br/> txt1=str_trimleft(textstr1); //删除字串头部换行符、TAB符以及空格<br/> txt1=str_trimright(txt1); //删除字串尾部换行符、TAB符以及空格<br/> txt1=spacecntrl_strtrim(txt1);<br/> _tcscpy(tmp1,txt1);<br/> txt=str_trimleft(textstr); //删除字串头部换行符、TAB符以及空格<br/> ep=strrealloc(ed,txt); //重新分配内存<br/> acedTextBox(ep,p1,p2);<br/> dist=acutDistance(p2,pt2);<br/> acutPolar(pick,textrz,dist,pp); //计算下一个单字的插入点<br/> pick=pp;<br/> pick=pp;<br/> la=entitem(ep,10);<br/> la->resval.rpoint=pick;<br/> la->resval.rpoint=pick;<br/> txt=str_trimright(txt); //删除字串尾部换行符、TAB符以及空格<br/> txt=spacecntrl_strtrim(txt);<br/> _tcscpy(tmp,txt);<br/> _tcscat(tmp,tmp1);<br/> ep=strrealloc(ed,tmp);<br/> acdbEntDel(text1);<br/> <font color="#ff3300">acdbEntMod(ep);</font> <font color="#f70909">//程序运行至此完蛋?</font><br/> acutRelRb(ed);<br/>// delete txt,txt1;<br/> }<br/> else<br/> {<br/> acedAlert(_T("字串太长,不能超过1000个字符!"));<br/> acutRelRb(ed);<br/> }<br/>}<br/>//=====主程序========================================================<br/>void join::txtmjoin()<br/>{<br/> int old1,old2,new1,new2;<br/> ads_name ename,ename1;<br/> ads_point ptres;<br/> struct resbuf *etype,*tlist;</p><p> new1=0;new2=0;<br/> change_var(_T("blipmode"),new1,&old1);<br/> change_var(_T("cmdecho"),new2,&old2);<br/> if(acedEntSel(_T("\n请拾取基准文字串:\n"),ename,ptres)!=RTCAN)<br/> {<br/> tlist=acdbEntGet(ename);<br/> etype=entitem(tlist,0);<br/> if(etype!=NULL && (_tcscmp(etype->resval.rstring,_T("TEXT")))==0)<br/> {<br/> if(acedEntSel(_T("\n再拾取后续文字串:\n"),ename1,ptres)!=RTCAN)<br/> {<br/> tlist=acdbEntGet(ename1);<br/> etype=entitem(tlist,0);<br/> if(etype!=NULL && (_tcscmp(etype->resval.rstring,_T("TEXT")))==0)<br/> {<br/> jointxt(ename,ename1);<br/> }<br/> else<br/> {<br/> acdbFail(_T("\n未选中文本实体"));<br/> }<br/> }<br/> else<br/> {<br/> acdbFail(_T("用户中断\n"));<br/> }<br/> }<br/> else<br/> {<br/> acdbFail(_T("\n未选中文本实体"));<br/> }<br/> }<br/> else<br/> {<br/> acdbFail(_T("用户中断\n"));<br/> }<br/> acutRelRb(tlist);<br/> change_var(_T("blipmode"),old1,&new1);<br/> change_var(_T("cmdecho"),old2,&new2);<br/>}</p>
页:
[1]