gouckchenwy 2014-08-27 04:17 采纳率: 0%
浏览 3442

C++ QT 运行时错误read access violation

void AccountWindow::displayEvent(const QDate &curDate)
{
QFile file(filename);
file.open(QIODevice::ReadOnly);
QDataStream in(&file);
while(!in.atEnd())
{
    Event *p = new Event;
    in.readRawData((char *)p, sizeof(Event)); 
    if (p->getStartDate() == curDate)
    {
        QString strEvent;
        strEvent = p->getStartDate().toString("MM.dd")
                + p->getStartTime().toString("h:m") + " - "
                + p->getEndDate().toString("MM.dd")
                + p->getEndTime().toString("h:m") + "  "
                + p->getTitle() + '\n';     //此处调用函数
        ui->textBrowser->append(strEvent);
    }
}

//Event.cpp
QString Event::getTitle()
{
    return title;    //此处有错误
}

底层停止了因为它触发了一个异常。
在线程0中停止,因为: Exception at 0x744dc25a, code: 0xc0000005: read access violation at: 0x0, flags=0x0。

  • 写回答

1条回答

  • CSDN-Ada助手 CSDN-AI 官方账号 2022-10-25 19:41
    关注
    不知道你这个问题是否已经解决, 如果还没有解决的话:

    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^
    评论

报告相同问题?

悬赏问题

  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常
  • ¥15 关于风控系统,如何去选择
  • ¥15 这款软件是什么?需要能满足我的需求
  • ¥15 SpringSecurityOauth2登陆前后request不一致