重载 set_invalid_parameter_handler

来源:互联网 发布:傅园慧网络直播全视频 编辑:程序博客网 时间:2024/05/17 20:29

重载 set_invalid_parameter_handler

#include "stdafx.h"
#include<crtdbg.h>
#include <conio.h>
char src[]="hello";
char dest[3];
void newf(const _TCHAR* expr,const _TCHAR* func, const _TCHAR* file,UINT line,uintptr_t pReserve){
    printf("in expression %s,function %s, file %s, line %d\n",expr,func,file,line);
}
int _tmain(int argc, _TCHAR* argv[])
{
    _invalid_parameter_handler oldh;
    oldh=_set_invalid_parameter_handler(newf);
     
    _CrtSetReportMode(_CRT_ASSERT, 0); //加这句试试
     
    memcpy_s(dest,sizeof(dest),src,sizeof(src));
    getch();
    return 0;
}

0 0