exe在VS2017中的C ++应用程序中触发了一个断点

时间:2018-03-09 21:37:51

标签: c++ visual-studio-2017

我在C ++应用程序中有以下方法,每次在Visual Studio中的调试模式下调用此方法时,我都会得到调试器说" MyApp.exe已触发断点。"

它打破了最后的花括号。 我在SO中发现了许多带有此错误的消息,但没有一个解决方案有效。

void
ShowEvent(HDBOBJ obj)
{
    char *p, buf[16000];
    char priority[256];
    char sDate[256];
    char recno[256];
    char mesgtext[2000];

    /*if (dbAttrGetInt(obj, ATTR_LOG_CURRENT)) {
        sprintf_s(buf, "C\t");
    }
    else {
        sprintf_s(buf, " \t");
    }*/

    dbAttrGetStr(obj, ATTR_LOG_PRIORITY, priority, sizeof(priority) + 1);
    sprintf(buf + strlen(buf), "Priority:   %s\n", priority);

    dbAttrGetStr(obj, ATTR_LOG_DATE, sDate, sizeof(sDate) + 1);
    sprintf(buf + strlen(buf), "Date:   %s\n", sDate);

    dbAttrGetStr(obj, ATTR_LOG_MAPRECNO, recno, sizeof(recno) + 1);
    sprintf(buf + strlen(buf), "RecNo:   %s\n", recno);

    /*if (!strcmp(buf, "(none)")) {
        dbAttrGetStr(obj, ATTR_LOG_MESG, buf, sizeof(buf));
        strncpy(buf, &buf[29], 32);
        if (p = strchr(buf, ' ')) {
            *p = 0;
        }
        buf[32] = 0;
    }*/

    dbAttrGetStr(obj, ATTR_LOG_MESGTEXT, mesgtext, sizeof(mesgtext) + 1);
    sprintf(buf + strlen(buf), "MesgText:   %s\n", mesgtext);

    MessageBox(0, buf, "Event Details", MB_OK | MB_OKCANCEL);

} // Breaks here with message "MyApp.exe  has triggered a breakpoint."

0 个答案:

没有答案