运行delete之后出现HEAP_CORRUPTION_DETECTED错误
VS++代码
char * test = new char[2];   
test[2]='b';
delete []test;
运行delete之后出现HEAP_CORRUPTION_DETECTED错误,有哪位大神指点一二……

2个回答

char* pCmd = new char[9];
你这样的写法表示只申请了9个字节的空间,pCmd合法的下标访问区间是0~8
pCmd[9]='1';这样会直接造成越界写入,破坏了堆空间,造成delete出错

aimuHeart
aimuHeart 多谢,忘了下标的范围了
大约 3 年之前 回复
问题补充:以下代码没有问题
char* pCmd = new char[9];  
memset( pCmd, 0, 9);
delete [] pCmd;
而加了一句对最后一个字符的赋值就出现HEAP_CORRUPTION_DETECTED错误
    char* pCmd = new char[9];    
memset( pCmd, 0, 9);
pCmd[9]='1';
delete [] pCmd;
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
delete出现的两个错误
create table teacher(tno char(6) primary key,ntname varchar(20) not null,nauthority varchar(10) not null,npassword varchar(20) not nulln);nninsert into teacher values('xg2221','钟飞','teacher','123456');ninsert into teacher values('111111','张欢欢','teacher','123456');n有两个错误:n1、、、、、、、、、、、、、、、、、、、、、、npublic class TeacherDaoImplnpublic static void main(String[] args) n TeacherDaoImpl tdi=new TeacherDaoImpl();n String[] str="111111";n tdi.deleteTeacherByNo(str);n n public int deleteTeacherByNo(String[] tno) n con=DBUtils_mssql.getCon();n String tnos="";n for(int i=0;i
用VC6.0运行之后出现这种错误
---------------------------rnMicrosoft Visual C++ Debug Libraryrn---------------------------rnDebug Assertion Failed!rnrnProgram: ...s\yuwei\Desktop\ImageConvert\ImageConvert\bin\ImgConvertD.exernFile: fopen.crnLine: 53rnrnExpression: file != NULLrnrnFor information on how your program can cause an assertionrnfailure, see the Visual C++ documentation on asserts.rnrn(Press Retry to debug the application)rn---------------------------rn中止(A) 重试(R) 忽略(I) rn---------------------------rn大家帮忙搞一下rn
delete csocket出现内存错误
我把问题简化一下rnm_socket=new Cclientsocket(this);rnm_sockfile=new CSocketFile(m_socket);rnm_in=new CArchive(m_sockfile,CArchive::load);rnm_out=new CArchive(m_sockfile,CArchive::store);rnrndelete m_sockfile;rndelete m_socket;rndelete m_out;rndelete m_in;rnrn然后调用delete 出现了内存错误 请问怎么解决 难道CSOCKET 用了new 不用调用delete就能自动释放内存吗?
delete语句中出现的错误!
小弟打算删除数据表的中一个记录。报错如下:rnrn服务器: 消息 547,级别 16,状态 1,行 1rnDELETE 语句与 COLUMN REFERENCE 约束 'FK_sys_xmckz_sys_jyxm1' 冲突。该冲突发生于数据库 'lisdata',表 'sys_xmckz', column 'xmid'。rn语句已终止。rnrn考虑是本表和其他表的主键有关联冲突,无法删除,请问高人如何解决?
使用requiredfieldvalidator之后出现错误
我使用requiredfieldvalidator来验证一个文本框是否为空,但是同时页面上的button按钮缺不好用了,点击后不做任何动作了.这是怎么回事?rn把requiredfieldvalidator移除就正常了,这里不用requiredfieldvalidator又实在是太麻烦rn多谢各位了
对话框运行出现错误..
错误:fatal error C1083: Cannot open source file: 'D:\Documents and Settings\vc\对话框\MsgDlg.cpp': No such file or directoryrnError executing cl.exe.rn说找不到源文件~这是什么回事呀~我什么都没动~清高手指教~在哪能恢复原文件
数据库运行出现错误
我学ACCESS数据库VBA编程,有下面这一段程序,rnPrivate Sub cmd_连接_Click()rnDim i As IntegerrnDim rcd As StringrnDim cn As ADODB.ConnectionrnDim rs As New ADODB.RecordsetrnSet cn = CurrentProject.Connectionrnrs.Open "T0040_原材料清单", cnrnDo Until rs.EOF = Truern For i = 0 To rs.Fields.Count - 1rn rcd = rcd & rs.Fields(i) & " "rn Next irn rs.MoveNextrn rcd = rcd & Chr(10)rnLooprnMsgBox rcd, , rs.Source & " 的记录集"rnrs.Close: Set rs = Nothingrncn.Close: Set cn = NothingrnEnd Subrn可是运行时出现错误:rn[img=https://img-bbs.csdn.net/upload/201903/21/1553132918_19167.jpg][/img]rn出错行代码:rnDim cn As ADODB.Connectionrn请高手指教,如何解决?谢谢!
opencv运行出现错误
当出现错误 AttributeError: 'NoneType' object has no attribute 'copy' 进行图像检测时,一般就是你读取的路径不对,没读取到图像,或是读取图像的格式不对,如JPG写成png格式 ...
运行程序出现的错误
我点击“开始运行”,就出现一个提示框,内容是“JIT调试失败,出现以下错误:拒绝访问。JIT调试由用户帐户NT AUTHORITY\NETWORK SERVICE 启动。rn这是什么原因呢?
运行MVC出现的错误
--------------------------------------------------------------------------------rnrn对控制器类型“StoreController”的操作“Details”的当前请求在下列操作方法之间不明确: rn类型 MvcApplication4.Controllers.StoreController 的 System.Web.Mvc.ActionResult Details(Int32)rn类型 MvcApplication4.Controllers.StoreController 的 System.String Details() rnrn这是程序相关代码:rn // GET: /Store/Browsernrn public ActionResult Details(int id)rn rnrn var book = new Book Title = "书籍 " + id ;rnrn return View(book);rnrnrnrn rnrn我是新手。谢谢
运行出现错误!
我在编译我的程序是没有错误,但当运行到第5个窗体的时候,出现了这样的错误rn我不知道是怎么回事rnproject progect1.exe raised exception class eaccessviolation withrnmessage'access violation at addree 004038D9 in module'PROJECT1.EXE'.rnread of address FFFFFFFB' process stopped.use step or run to contiune.
Java运行出现错误
Java编程后运行出现错误: Java HotSpot™ 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended 搞了很久也没更改正确,在线请教,谢谢! ...
运行出现错误
请教,哪里错了。rn#includern#includernusing namespace std;rnint main()rn string text;rn const string sep=",.\"\n ";rn const int max_word=100;rn string word[max_word]=0;rn cout<<"请输入一段话(以#结束):";rn getline(cin,text,'#');rn int start=text.find_first_not_of (sep);rn int end=0;rn int word_count=0;rn while(start!=string::npos&&word_count
FFmpeg运行出现的错误
ffmpeg正常安装后执行ffmpeg时出现如下错误: ffmpeg: error while loading shared libraries: libavdevice.so.53: cannot open shared object file: No such file or directory 解决办法: vi /etc/ld.so.conf 加入:/usr/local/lib 执
qt5运行出现错误
运行qt项目的时候出现如下错误: usr/bin/ld: cannot find -lGL collect2: error: ld returned 1 exit status make: Leaving directory `/root/QT5/CH4/CH401/DialogExample' make: *** [DialogExample] Error 1 14:02:03: Th
运行java-plugin出现错误
我写了一个Applet (名字为Applet1.java)以及一个jar档案(dt5.jar),一个JSPrn页面。主要程序为rnrnrnNot Support!rnrnrn注册表里JAVA插件为1.3rn运行为Not Support!rn不知哪位能为我解决?先谢了
delphi 运行出现错误
如题 运行 点击某个按钮之后 出现错误rnraise execption EInvalidGridOperation with message'Grid index out of range'rnrn不知道是什么问题? 看意思 好像是Grid超出界限了?rn要怎么解决rnrn还有一个问题 是关于DBGrid的 rn我把从数据库里面查询出来的数据放到DBGrid 滚动滚轮 可是数据到了显示的最下面就不继续下去了 rn实际上 还有好多数据在下面 而且 光标 也是停留在上面我刚一开始点中的那一行,并没有随着我的滚轮而相应的rn往下走 不知道高手 这个是属性里面设置的嘛?
运行是出现的错误
当我运行一个程序的时候出现下面的对话框,是什么意思?rn"0x00404ea0"指令引用的"0xcccccccc"内存。该内存不能为"read"。rn要终止程序,请单击“确定”。rn要调试程序,请单击“取消”。下面的程序是我运行的源代码.估计应该和代码没有关系rn源代码是:rn#includern#includernconst char null='\0';rnstatic char *strsave(char *s)rnrn char *p;rn p=new char[strlen(s)+1];rn strcpy(p,s);rn return p;rnrnclass Date_recrnrnprotected:rn char *name;rn char *id_number;rnpublic:rn Date_rec()rn rn name=null;rn id_number=null;rn rn Date_rec(char *name1,char *idnumber1)rn rn name=strsave(name1);rn id_number=strsave(id_number);rn rn ~Date_rec()rn rn delete []name;rn delete []id_number;rn rn void print()rn rn cout<<"\n"<<"name:"<
运行出现如下错误!
import java.awt.Color;rnimport java.io.*; rnimport java.util.ArrayList;rnimport java.util.List;rnrnimport org.jfree.data.*; rnimport org.jfree.chart.*; rnimport org.jfree.chart.plot.*; rnimport org.jfree.chart.renderer.category.BarRenderer3D;rnimport org.jfree.data.category.CategoryDataset;rnimport org.jfree.data.category.DefaultCategoryDataset;rnimport org.jfree.chart.demo.BarChartDemo1;rnrn rnrnpublic class JFreeBarChartDemo rnrnrn public static void main(String[] args) throws IOExceptionrn //第一步:设置数据源 rn CategoryDataset dataset = getDataSet2(); rn //第二步:生成jfreechart图形rn JFreeChart chart = ChartFactory.createBarChart3D( rn "水果产量图", // 图表标题 rn "水果", // 目录轴的显示标签 rn "产量", // 数值轴的显示标签 rn dataset, // 数据集 rn PlotOrientation.VERTICAL, // 图表方向:水平、垂直 rn true, // 是否显示图例(对于简单的柱状图必须是false) rn false, // 是否生成工具 rn false // 是否生成URL链接 rn ); rn // 第三步:生成装载图形的特殊面板 [Jv5kl_Q rn chart.setTitle("这里设置标题"); rn CategoryPlot plot = chart.getCategoryPlot();rn //设置颜色rnrn BarRenderer3D renderer = new BarRenderer3D();rn renderer.setSeriesPaint(0, Color.green);rn renderer.setSeriesPaint(1, new Color(0, 100, 255));rn renderer.setSeriesPaint(2, Color.RED); plot.setRenderer(renderer);rnrn rn FileOutputStream fos_jpg = null; rn try rn fos_jpg = new FileOutputStream("D:\fruit.jpg"); rn ChartUtilities.writeChartAsJPEG(fos_jpg,1,chart,400,300,null); rn finally rn try rn fos_jpg.close(); rn catch (Exception e) rn rn rn rn private static CategoryDataset getDataSet() rn DefaultCategoryDataset dataset = new DefaultCategoryDataset(); rn dataset.addValue(100, null, "苹果"); rn dataset.addValue(200, null, "梨子"); rn dataset.addValue(300, null, "葡萄"); rn dataset.addValue(400, null, "香蕉"); rn dataset.addValue(500, null, "荔枝"); rn return dataset; rn rn rn private static CategoryDataset getDataSet2() rn DefaultCategoryDataset dataset = new DefaultCategoryDataset();rn rnrn dataset.addValue(100, "北京", "苹果"); rn dataset.addValue(100, "上海", "苹果"); rn dataset.addValue(100, "广州", "苹果"); rn dataset.addValue(200, "北京", "梨子"); rn dataset.addValue(200, "上海", "梨子"); rn dataset.addValue(200, "广州", "梨子"); rn dataset.addValue(300, "北京", "葡萄"); rn dataset.addValue(300, "上海", "葡萄"); rn dataset.addValue(300, "广州", "葡萄"); rn dataset.addValue(400, "北京", "香蕉"); rn dataset.addValue(400, "上海", "香蕉"); rn dataset.addValue(400, "广州", "香蕉"); rn dataset.addValue(500, "北京", "荔枝"); rn dataset.addValue(500, "上海", "荔枝"); rn dataset.addValue(500, "广州", "荔枝"); rn return dataset; rn rn rn rn rnrnrn运行出现下面错误:rnException in thread "main"java.io.FileNotFoundException:D:fruit.jpgrnat java.io.FileOutputStream.openrnat java.io.FileOutputStream.rnat java.io.FileOutputStream.rnat JFreeBarChartDemo.main< JFreeBarChartDemo.java:46>
运行过程中,出现错误
[img=http://img.my.csdn.net/uploads/201303/28/1364474966_6118.jpg][/img]
运行PHP程序出现错误
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/php/ext\php_xsl.dll' - 找不到指定的模块
运行 VS2005出现错误 ~!
error while trying to run project unable to start debugging on the web server.rn click help for more information
运行出现的错误
我运行VC++程序,出现了这样的错误:rnfatal error C1083:cannot open precompiled header file :'Debug/DMS.pch':rnno such file or directory.rn光标指向#include"stdafx.h"rn这是什么问题,怎么解决?请高手指教
delete[]之后的內存.........
#include rnusing namespace std;rnint main()rnrn int* p = new int[ 10 ];rn for( int ix = 0; ix < 10; ix++ )rn p[ ix ] = ix;rn rn delete []p; //delete到底把p做了什么動作?rn for( int jx = 0; jx < 10; jx++ )rn rn p[ jx ] = jx;rn cout << p[ jx ] << endl;rn rn return 0;rnrnrnrn為什么這段代碼沒有問題?
tomcat在服务器中部署运行之后,浏览器出现400错误
找不到网页 rn您要查看的网页可能已被删除、名称已被更改,或者暂时不可用。 rnrn--------------------------------------------------------------------------------rnrn请尝试以下操作:rnrn如果您已经在地址栏中输入该网页的地址,请确认其拼写正确。rnrn打开 localhost:8090 主页,然后查找指向您感兴趣信息的链接。 rn单击后退按钮,尝试其他链接。 rn单击搜索,寻找 Internet 上的信息。 rnrnrnrnHTTP 400 - 错误请求rnInternet Explorer rnrnrn我在浏览器中输入http://localhost:8090/ 之后会出现这样400错误,我环境变量都配置path,classpath,javahome也配置了。rnrn我现在项目要放到服务器上面去运行,服务器是2003版本的系统。rn本人在线等回答。。rn急!急!急!急!急!急!急!急!急!急!急!急!急!rn
Java swt运行之后出现的错误,怎么解决呢?
Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3236 in java.library.pathrn at java.lang.ClassLoader.loadLibrary(Unknown Source)rn at java.lang.Runtime.loadLibrary0(Unknown Source)rn at java.lang.System.loadLibrary(Unknown Source)rn at org.eclipse.swt.internal.Library.loadLibrary(Library.java:123)rn at org.eclipse.swt.internal.win32.OS.(OS.java:18)rn at org.eclipse.swt.widgets.Display.(Display.java:125)rn at Me.open(Me.java:34)rn at Me.main(Me.java:24)
【求助】工具封包之后运行出现“.NET Framework初始化错误”
用VS2005做的个小工具,Release出来的程序可以正常运行。但是用MoleBox封包之后,在运行时就出现“.NET Framework初始化错误”及“找不到运行此应用程序的运行库的任何版本”。Release文件夹下所有的文件都一起封包了。请问还应该怎么做,才不会出现上述的错误呢?
求大神指点!运行IIS之后登陆asp出现错误!
.NET FrameWork环境也有了rn配置也配置好了rn压缩包也解压到需要安装的web站点下rnrn错误提示:rnrn[color=#FF0000]Microsoft VBScript 运行时错误 错误 '800a01ad'rnrnActiveX 部件不能创建对象rnrn/manage/login.asp,行 27[/color]rnrnrnlogin.asp代码:rnrn[color=#FF0000]<%rnResponse.Buffer=TruernResponse.ExpiresAbsolute=Now()-1rnResponse.Expires=0rnResponse.CacheControl="no-cache"rnResponse.AddHeader "Pragma","No-Cache"%>rnrnrnrn 盛维在线调查系统v9.0免费版-&gt后台管理登录rn rn rn rnrn rn<%rn'dim DConnrnreturnFile=request.form("returnFile")rntoFile=request.form("toFile")rnIf Request.ServerVariables("REQUEST_METHOD")="POST" and returnFile<>"" Thenrn data100_login returnFile,toFilernelsern Response.Redirect "../survey-sys.asp?toFile=main.asp"rnend ifrnrnfunction data100_login(returnFile2,toFile2)'注册子程序rn Set ObjDCW = Server.CreateObject("dc_data100_v1_0.C_A_Config")rn ObjDCW.Chklogin DataPathFile,WebPath,returnFile2,toFile2rnend functionrn%>rnrnrnrn[/color]rnrnrn[img=https://img-bbs.csdn.net/upload/201309/30/1380512324_933160.jpg][/img]rn[img=https://img-bbs.csdn.net/upload/201309/30/1380512340_807800.jpg][/img]rnrn我已经HOLD不住了啊,求大神指点!
下面运行之后出现的错误 为什么 ??????? 谢谢解答者
rnE:\>java ConSqlserverrnjava.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriverrn at java.net.URLClassLoader$1.run(URLClassLoader.java:200)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(URLClassLoader.java:188)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:306)rn at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:251)rn at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)rn at java.lang.Class.forName0(Native Method)rn at java.lang.Class.forName(Class.java:164)rn at ConSqlserver.(ConSqlserver.java:10)rn at ConSqlserver.main(ConSqlserver.java:21)rnrn这是运行之后出现的错误 为什么 ??????? 谢谢解答者 rn
delete的错误
写的是一个记事本程序,可是我按Backspace键时。运行出错,rn[code=C/C++]rn if(wParam==VK_BACK)rn rn if(head->next==NULL)rn MessageBox(hwnd,"最前端",NULL,MB_OK);rn elsern rn if(curp->next == NULL)rn rn prep = prep->pre ; rn delete curp;rn curp = prep->next ;rn curp->next =NULL; //debug到这一步是,可以看到curp开始指向的节点 已 //经删除,并且移向了前一节点,即实现了删除,为什么运行时还会报错rn rn else //当光标不在最后的位置时,删除当前节点,移动的光标功能我还没写,所以这里可以不要看rn rn prep->next = curp->next ;rn curp->next ->pre = prep;rn delete curp;rn curp = prep->next ;rn rn rn InvalidateRect(hwnd,NULL,TRUE);rn rn break;rn rn[/code]rn这是那一段代码,我也debug了,明明没看出delete出错了,rnrn你们看下我节点的定义 和上面粘贴的代码就可以了, 我也把完整的代码贴上来,rn[code=C/C++]rn/*3月10日,全部刷新显示*/rn#include rn#include rn#include rnrnstruct LNodernrn UINT data;rn struct LNode* next;rn struct LNode* pre;rn;rn rnLNode* InitClist()rnrn LNode* head = new LNode;rn head->next = NULL;rn head->pre = NULL;rn head->data=0;rn return head;rnrnrnLNode* curp; //当前节点指针rnLNode* prep; //前一节点指针rnLNode* head; //头节点指针rnrnrnLRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);rnrnint APIENTRY WinMain(HINSTANCE hInstance,rn HINSTANCE hPrevInstance,rn LPSTR lpCmdLine,rn int nCmdShow)rnrn // TODO: Place code here.rn HWND hwnd;rn WNDCLASS wndclass;rn MSG msg;rn char lpszClassName[]="Window";rn char lpszTitle[]="NotePad";rn wndclass.style = CS_OWNDC;rn wndclass.lpfnWndProc = WndProc;rn wndclass.cbClsExtra = 0;rn wndclass.cbWndExtra = 0;rn wndclass.hInstance = hInstance;rn wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);rn wndclass.hCursor = LoadCursor(NULL,IDC_ARROW);rn wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);rn wndclass.lpszMenuName = NULL;rn wndclass.lpszClassName = lpszClassName ;rn rn if(!RegisterClass(&wndclass))rn return FALSE;rnrn hwnd= CreateWindow(lpszClassName,lpszTitle,WS_OVERLAPPEDWINDOW,rn CW_USEDEFAULT,CW_USEDEFAULT,rn CW_USEDEFAULT,CW_USEDEFAULT,rn NULL,NULL,rn hInstance,rn NULL);rn head=InitClist();rn curp=head;rn prep=NULL;rn ShowWindow(hwnd,nCmdShow);rn UpdateWindow(hwnd);rn while(GetMessage(&msg,NULL,0,0))rn rn TranslateMessage(&msg);rn DispatchMessage(&msg);rn rn return 0;rnrnrnLRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam ,LPARAM lParam)rnrn int xchar=0,ychar=0; //存放当前串所占的宽度和高度rn int num;rn LNode* print;rn static BOOL Word= TRUE;rn RECT rtClient;rn HDC hdc;rn HCURSOR hCursor;rn TEXTMETRIC tm;rn PAINTSTRUCT ps;rn SIZE size;rn static char buf[2];rn static int nNumChar=0;rn static int nArrayPos=0;rn switch(message)rn rn case WM_CREATE:rn hdc = GetDC(hwnd);rn GetTextMetrics(hdc,&tm); rn ReleaseDC(hwnd,hdc);rn CreateCaret(hwnd,NULL,2,tm.tmHeight-2 ); //创建一个标记,比字符高度小2个逻辑单位rn ShowCaret(hwnd); //显示标记rn break;rn case WM_PAINT: //应增加 改变窗口大小就全部重绘的代码rn hdc=BeginPaint(hwnd,&ps);rn SetTextColor(hdc,RGB(255,0,0));rn rn GetTextMetrics(hdc,&tm);rn ychar= tm.tmHeight+tm.tmExternalLeading ;rn if(head->next != NULL)rn rn print=head->next ;rn for(num=0;numdata ;num++)rn rn if(print->data <128)rn rn if(print->data !=13)rn rn buf[0]= char(print->data );rn GetTextExtentPoint32(hdc,&buf[0],1,&size);rn xchar = xchar+size.cx;rn ::GetClientRect(hwnd,&rtClient);rn if(xchar>=rtClient.right )rn rn xchar = size.cx ;rn ychar = ychar+ size.cy + tm.tmExternalLeading ;rn rn TextOut(hdc,xchar-size.cx,ychar-size.cy,buf,1);rn rn elsern rn xchar = 0;rn ychar = ychar+ size.cy + tm.tmExternalLeading ;rn rn print=print->next ;rn rn elsern rn buf[0]=print->data /256;rn buf[1]=print->data %256;rn GetTextExtentPoint32(hdc,buf,2,&size);rn xchar = xchar+size.cx;rn ::GetClientRect(hwnd,&rtClient);rn if(xchar>=rtClient.right )rn rn xchar = size.cx ;rn ychar = ychar+ size.cy + tm.tmExternalLeading ;rn rn TextOut(hdc,xchar-size.cx,ychar-size.cy,buf,2);rn print=print->next ;rn rn rn rn SetCaretPos(xchar,ychar-size.cy+2 );rnrn EndPaint(hwnd,&ps);rn break;rnrn case WM_SIZE:rn ::InvalidateRect (hwnd,NULL,TRUE);rn break;rn rn case WM_CHAR:rn if(wParam==VK_BACK)rn rn if(head->next==NULL)rn MessageBox(hwnd,"最前端",NULL,MB_OK);rn elsern rn if(curp->next == NULL)rn rn prep = prep->pre ;rn // prep->next->next =NULL;rn delete curp;rn curp = prep->next ;rn curp->next =NULL;rn rn elsern rn prep->next = curp->next ;rn curp->next ->pre = prep;rn delete curp;rn curp = prep->next ;rn rn rn InvalidateRect(hwnd,NULL,TRUE);rn rn break;rn rnrnrn rn if((unsigned)wParam<128)rn rn prep=curp;rn curp = new LNode;rn curp->pre = prep;rn prep->next = curp;rn curp->data = (unsigned)wParam;rn curp->next = NULL;rn head->data +=1;rn rn rn InvalidateRect(hwnd,NULL,FALSE);rnrn rn elsern rn if(Word) //Word为1表示汉字的高位录入rn rn prep=curp;rn curp = new LNode;rn prep->next = curp;rn curp->pre = prep;rn curp->next = NULL;rn Word=!Word;rn curp->data = (unsigned)wParam;rn curp->data=curp->data <<8;rn head->data +=1;rn rn elsern rn curp->data =curp->data + (unsigned)wParam;rn Word=!Word;rn InvalidateRect(hwnd,NULL,TRUE);rn rn rn rn rn break;rn case WM_DESTROY:rn PostQuitMessage(0);rn break;rn default:rn return DefWindowProc(hwnd,message,wParam,lParam);rn rn rn return 0;rnrnrnrn[/code]rn这个程序的功能主要是想实现记事本的功能,还有很多功能没有写,但是BackSpace出错了, 哪位高手帮忙解答一下。
delete错误
#includern#include"student.h"rnint main()rnrn char *str;rn str=new char[100];rn str="陈麟";rn Student s1(1,100,str);rn s1.print();rn delete []str;rn return 0;rnrn
c++ 动态分配内存delete多次出现的错误
new分配内存,delete之后再次delete时会出错。 windows系统出现类似错误,问题事件名称为 APPCRASH 。 #include int main() { int *a = new int; *a = 1; std::cout << a << std::endl; std::cout << *a << std::endl; delete a;
ADO使用的Record的delete出现的错误?
[code=C/C++] rn CString strQuery= "select * from UserList where UserName='chp845'";rn tryrn rn m_pRecordset->Open(_variant_t(strQuery),_variant_t((IDispatch *)m_pConnetion,true), // 获取库接库的IDispatch指针rn adOpenStatic,rn adLockOptimistic,rn adCmdText);rn m_pRecordset->MoveFirst();rn m_pRecordset->Delete(adAffectCurrent);rn rn catch(_com_error ex)rn rn AfxMessageBox(ex.Description());rn return FALSE;rn [/code]rn上面的代码执行,提示错误找不到存储单元chp845rn怎么这几天我使用删除语句也是这错误,高手求救了呀!
delete 指针后 出现_CrtIsValidHeapPointer断言错误
小弟的代码运行后出现如下断言错误rnMicrosoft Visual C++ Debug LibraryrnDebug Assertion Failed!rnProgram:F:\biao\Debug\biao.exernFile:dbgheap.crnLine:1044rnrnExpression:_CrtIsValidHeapPointer(pUserData)rnrnFor information on how your program can cause an assertionrnfailure,see the Visual C++ documant on assertsrnrn(Press Retry to debug the application) rnrn代码大概如下:rn int i, packetCount;rn PacketAnalyseResult* pResult = NULL; // PacketAnalyseResult 是我自己定义的一个结构;rn packetCount = historyBuffer.GetSize(); //historyBuffer 是CPtrArray;rn for (i=0; i
vs2010运行出现0xc000007b错误
本人电脑64位,安装的vs2010是32位,现在添加了fftw库函数,lib /def:libfftw3-3.def这种是在vs2010的兼容命令窗口进行的。rn测试时用的是这个代码:rnrn[code=c]#include "fftw3.h"rn#include rn#define N 8rnint main()rnrn int i;rn fftw_complex *din,*out;rn fftw_plan p;rn din = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);rn out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N);rn if((din==NULL)||(out==NULL))rn rn printf("Error:insufficient available memory\n");rn rn elsern rn for(i=0; i
运行tomcat出现错误!!求救
信息: Starting Servlet Engine: Apache Tomcat/6.0.20rn2009-11-24 16:04:50 org.apache.tomcat.util.digester.Digester endElementrn严重: End event threw exceptionrnjava.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:925)rn at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:193)rn at org.apache.tomcat.util.digester.Rule.end(Rule.java:229)rn at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1140)rn at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)rn at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)rn at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1644)rn at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:365)rn at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1066)rn at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4339)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)rn at org.apache.catalina.core.StandardService.start(StandardService.java:516)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:583)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)rnCaused by: java.lang.IllegalArgumentException: Filter mapping specifies an unknown filter name struts2rn at org.apache.catalina.core.StandardContext.addFilterMap(StandardContext.java:2237)rn ... 37 morern2009-11-24 16:04:50 org.apache.catalina.startup.ContextConfig applicationWebConfigrn严重: Parse error in application web.xml file at jndi:/localhost/struts_2/WEB-INF/web.xmlrnjava.lang.IllegalArgumentException: Filter mapping specifies an unknown filter name struts2rn at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2808)rn at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2834)rn at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1143)rn at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)rn at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)rn at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1644)rn at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:365)rn at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1066)rn at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4339)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)rn at org.apache.catalina.core.StandardService.start(StandardService.java:516)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:583)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)rn2009-11-24 16:04:50 org.apache.catalina.startup.ContextConfig applicationWebConfigrn严重: Occurred at line 16 column 24rn2009-11-24 16:04:50 org.apache.catalina.startup.ContextConfig startrn严重: Marking this application unavailable due to previous error(s)rn2009-11-24 16:04:50 org.apache.catalina.core.StandardContext startrn严重: Error getConfiguredrn2009-11-24 16:04:50 org.apache.catalina.core.StandardContext startrn严重: Context [/struts_2] startup failed due to previous errorsrn2009-11-24 16:04:51 org.apache.coyote.http11.Http11Protocol startrn信息: Starting Coyote HTTP/1.1 on http-8080rn2009-11-24 16:04:51 org.apache.jk.common.ChannelSocket initrn信息: JK: ajp13 listening on /0.0.0.0:8009rn2009-11-24 16:04:51 org.apache.jk.server.JkMain startrn信息: Jk running ID=0 time=0/62 config=nullrn2009-11-24 16:04:51 org.apache.catalina.startup.Catalina startrn信息: Server startup in 1355 msrnrnrn我的jdk是1.6.0_10的,jre6rn请指点,快逼疯了
自动运行类出现错误
写了一个自动运行类,让tomcat启动之后自动调用。但是总运行不成功,高手帮看看,谢谢!rnrn程序逻辑是这样的:rn1、tomcat调用一个定时器;rn2、定时器调用run方法;rn3、run方法首先到表里去查是否还有没有提醒的内容;rn4、如果有,则给相关的人员发送一条短信;rn内容涉及三个表,能够保证需要的内容都存在。rn另外,还想知道,在调试的时候如何把一些结果打印在屏幕上?rnrn从tomcat的日志来看,服务器已经找到这个类,出现了"定时器已启动321" 等字样。但是里面的内容好像没有执行。rnpublic class TimerListener implements ServletContextListener rn rn private Timer timer = null; rnrn public void contextInitialized(ServletContextEvent event) rn rn int rate; rn try rn rn rate = 7*24*60*60*1000; rn timer = new Timer(true);rn event.getServletContext().log("定时器已启动321");rn timer.scheduleAtFixedRate(new RemindTask(), 0, rate);rn// timer.scheduleAtFixedRate(new TimedoTask(), 0, rate);rn event.getServletContext().log("已经添加任务调度表321"); rn rn catch(Exception e) rn rn e.printStackTrace();rn rn rn public void contextDestroyed(ServletContextEvent event) rn rn timer.cancel(); rn event.getServletContext().log("定时器销毁244"); rn rnrnrn****************************************************************************rnrnpublic class RemindTask extends TimerTask rnrn public void run() rn rn try rn rn Connection conn = JdbcPool.getConnection(); rn Statement stmt = conn.createStatement(); rn String sqlstr= "select * from sys_mentioninfo where hasmention='no'"; rn ResultSet rs = stmt.executeQuery(sqlstr); rn while(rs.next()) rn rn String mentiontime = rs.getString("mentiontime").substring(0,10);rn SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd"); rn Date mentionTime = new java.util.Date();rn mentionTime = formatter.parse(mentiontime); // 字符串转换为时间类型rn Date currentTime = new Date();rn String sourcetime = formatter.format(currentTime); //将日期时间格式化rn long diffDays = (mentionTime.getTime()- currentTime.getTime())/(24*60*60*1000); rn System.out.print(diffDays);rn if(diffDays<=0)rn rn stmt = conn.createStatement(); rn sqlstr="select loginname from sys_personauth where sdoi='" + rs.getString("sdoi") + "' and serialcode='" + rs.getString("serialcode") + "'";rn ResultSet rs1= stmt.executeQuery(sqlstr);rn if(rs1.next()) rn rn rs1.beforeFirst(); rn while(rs1.next())rn rn stmt = conn.createStatement();rn sqlstr = "insert into sys_duanxin(sender,receiver,content,sendtime,ifdo) values('SYSTEM','" + rs1.getString("loginname") + "','" + rs.getString("content") + "','" + sourcetime + "','no')";rn stmt.executeUpdate(sqlstr);rn rn rn elsern rn throw new Exception("no record fit"); rn rn rn elsern rn throw new Exception("days not fit"); rn rn rn rn catch(Exception ef)rn rn ef.printStackTrace();rn rn rnrnrn rn
编译无错误,运行出现错误??
[code=C/C++]rn#include rn#include rn#include rnusing namespace std;rnrn#define ERROR 0rn#define OK 1rn#define OVERFLOW -2 rn#define NULL 0rnrntypedef structrn char *ch;rn int length;rnHString;rnrntypedef int Status;rnrnStatus StrAssign(HString &T,char* chars) rn if(T.ch) free(T.ch); //如果存在则释放rn int i; //用来求长度rn char *c;rn for(i=0,c=chars;*c;++i,++c); //求得i rn if(!i)rn T.ch=NULL;rn T.length=0;rn rn elsern if(!(T.ch=(char*)malloc(i*sizeof(char))))rn exit(OVERFLOW);rn for(int j=0; j<=i-1; ++j)rn T.ch[j]=chars[j]; //一一赋值rn T.length=i;rn rn return OK;rnrnrnvoid print(HString &T)//输出串rn int i;rn for(i=0;i<=T.length-1;i++) rn cout<
运行C程序出现错误
我运行C程序出现下面错误:rnLoaded 'ntdll.dll', no matching symbolic information found.rnLoaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.rnThe thread 0x67C has exited with code -1073741510 (0xC000013A).rnThe thread 0xF4C has exited with code -1073741510 (0xC000013A).rnThe program 'E:\C program\pro\t\Debug\t.exe' has exited with code -1073741510 (0xC000013A).rn请问是什么意思?
运行Client的时候出现错误
javax.naming.NameNotFoundException: Unable to resolve 'EmployeesRemote' Resolved: '' Unresolved:'EmployeesRemote' ; remaining name 'EmployeesRemote'rnrn at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:109)rnrn at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:263)rnrn at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:230)-- Failed initializing bean access.rnrnrnrn at weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown Source)rnrn at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:337)rnrn at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:332)rnrn at javax.naming.InitialContext.lookup(InitialContext.java:350)rnrn at cmpmodule2.EmployeesTestClient.(EmployeesTestClient.java:28)rnrn at cmpmodule2.EmployeesTestClient.main(EmployeesTestClient.java:1245)rnrnjava.lang.NullPointerExceptionrnrn at cmpmodule2.EmployeesTestClient.findByPrimaryKey(EmployeesTestClient.java:107)rnrn at cmpmodule2.EmployeesTestClient.main(EmployeesTestClient.java:1251)rnrn-- Calling findByPrimaryKey(1)rnrn-- Failed: findByPrimaryKey(1)rnrn-- Return value from findByPrimaryKey(1): null.rnrnErrorrnrn这是不是因为没有部署好?rn我是用JBuilder+WEBLOGICrn怎样知道有没有部署成功?rn谢谢rn
相关热词 c# 标准差 计算 c#siki第五季 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池