用 try ...Catch... 把new 包起来试试。
解决方案 »
- XML解析库已经完成了,散个分。
- Server/Client文件传输问题,很怪异。。
- Socket传结构体
- A dynamic link library(dll) initialization routime failed
- 关于应用层数据包的分析问题
- MFC的CFileDialog类创建一个系统保存对话框,这个对话框能否保存文件?
- 关注Vc的变化和未来.net的发展方向
- 帮帮忙
- SetMenuInfo 设置menu背景
- 专家门诊的所有历史资料在什么地方???????????????????
- 求书《VC++6.0技术内幕》(第五版)!!哈尔滨市内
- 急:AfxMessageBox函数中如何分行显示长文本,有否其他函数
具体:
try
{
a=new int[999....999];
if(a==NULL)
{
AfxMessageBox("error");
throw"Memery allocation failed";
}
else delete a;
}
Catch(char * exception)
{
cout<<exception<<endl;
}
..........
另外,你申请的也太大了点吧,呵呵
具体:
try
{
a=new int[999....999];
if(a==NULL)
{
AfxMessageBox("error");
throw"Memery allocation failed";
}
else delete a;
}
Catch(char * exception)
{
cout<<exception<<endl;
}
..........
另外,你申请的也太大了点吧,呵呵
看看这段代码:#include <stdio.h>
#include <new.h>// Define a function to be called if new fails to allocate memory.
int MyNewHandler( size_t size )
{
clog << "Allocation failed. Coalescing heap." << endl; // Call a fictitious function to recover some heap space.
return CoalesceHeap();
}void main()
{
// Set the failure handler for new to be MyNewHandler.
_set_new_handler( MyNewHandler ); int *a = new int[999999999];
}
上面见得清清楚楚,明明白白,真真切切。
呵呵