我写了个很小的程序,来处理除0错误:#include"stdafx.h"
#include<windows.h>
int main(void){
int i=0;
int j=2;
int k;
DWORD dwCode;
__try{
k=j/i;
}__except(dwCode=GetExceptionCode()){
printf("dwCode=%d\n",dwCode);
}
return 0;
}程序只要一运行,在debug的Output窗口里面不停的输出:
mytest.exe 中的 0x004135d8 处最可能的异常: 0xC0000094: Integer division by zero
mytest.exe 中的 0x004135d8 处最可能的异常: 0xC0000094: Integer division by zero
mytest.exe 中的 0x004135d8 处最可能的异常: 0xC0000094: Integer division by zero这是为什么呢?
__try/__except本身不是循环啊。而且既然我已经捕获和处理了异常,为什么还有问题?
#include<windows.h>
int main(void){
int i=0;
int j=2;
int k;
DWORD dwCode;
__try{
k=j/i;
}__except(dwCode=GetExceptionCode()){
printf("dwCode=%d\n",dwCode);
}
return 0;
}程序只要一运行,在debug的Output窗口里面不停的输出:
mytest.exe 中的 0x004135d8 处最可能的异常: 0xC0000094: Integer division by zero
mytest.exe 中的 0x004135d8 处最可能的异常: 0xC0000094: Integer division by zero
mytest.exe 中的 0x004135d8 处最可能的异常: 0xC0000094: Integer division by zero这是为什么呢?
__try/__except本身不是循环啊。而且既然我已经捕获和处理了异常,为什么还有问题?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货