Cannot access memory at adress 0xbf9

当遇到'Cannot access memory at adress 0xbf9'的错误时,这通常意味着应用程序尝试访问无效的内存地址。在Windows环境下,此错误信息会发送给调试器,而在调试版本中,函数会导致程序在Unix系统上终止并生成核心转储,或者在Windows上报告_CRT_ERROR以便连接调试器。该问题与库函数、应用执行和命令行环境有关。

1、Cannot access memory at adress 0xbf9

     开始遇到这种错误不知道怎么解决,前两天也遇到过问题那是因为没有对串口进行打开操作就进行其他的后续操作了,所以在运行程序的时候是直接出错,而不是现在这个样子,点击按钮之后才出现错误。
     我现在还没找到解决办法,猜测是不是数组有问题
     a. 我把读串口的readMyCom()私有函数的代买注视掉一行就不会出现上面的问题,这个函数的代码是:
     viod MainWindow::readMyCom()
     {
          QByteArray temp;
          temp = myCom -> readAll();
          if (!temp.isEmpty())
          {
               if(cmd[1] == temp[1])           // cmd是我定义的一个8个数据元素的数组cmd[] = {1,2,3,4,5,6,7,8}
               {
                    ui -> textBrowser -> append(tr("Receive: ") + temp);  
//                 qFatal("Read Success!");               // 我把这行注视掉就没错了,不明白为什么,现在我终于明白“要怀疑一切”。
               }
          }
     }
     b. 这里的qFatal()是这样的函数(摘录Qt API4_3_4.CHM):
          void   qFatal   ( const char *   msg , ... )

Calls the message handler with the fatal message  msg . If no message handler has been installed, the message is printed to stderr. Under Windows, the message is sent to the debugger.

For a release library this function will exit the application with return value 1. For the debug version this function will abort on Unix systems to create a core dump, and report a _CRT_ERROR on Windows allowing to connect a debugger to the application.

This function takes a format string and a list of arguments, similar to the C printf() function.

Example:

 int divide(int a, int b)
 {     
     if (b == 0)                                //
 program error         
            qFatal ("divide: cannot divide by zero");  
     return a / b; 
}

Warning:   The internal buffer is limited to 8192 bytes, including the '/0'-terminator.

See also  qDebug (),  qCritical (),  qWarning (),  qInstallMsgHandler (), and  Debugging Techniques .

     
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值