我的程序中要加个出错警告,要用,try - catch char buf[1024]; try{ getbuf(buf); }
catch(Execption e) // buf溢出
{
rtn = false;
}
return rtn;
能这样捕获buf的溢出问题吗????
catch(Execption e) // buf溢出
{
rtn = false;
}
return rtn;
能这样捕获buf的溢出问题吗????
error C2310: catch handlers must specify one type
error C2317: 'try' block starting on line '396' has no catch handlers
你可以查看getbuf这个函数的用法,可能是估计返回值来判断是否出错的
要抛出异常才能捕获啊。getbuf(buf) 是你自个定义的吧
throw new Exception();---定义类似的语句吗?
throw -1
catch(int)
{
这里只能捕获BUF出错的内容,我想用MssageBox显示别的变量该怎么做啊???
}
debug版本里内存有边界保护,所以能报告出来!