定义:
mutable string  buf;
mutable int     bufSize在程序中某个地方赋值:
buf = pTempBuf
bufSize = tempBufLen在另外一个地方用到:pTempBuf = tempBuf;
if(stIter->bufSize != 0)

    memcpy(pTempBuf,buf.c_str(),bufSize);
} 当运行到memcpy这句时弹出错误窗口:
The instruction at "0x10216393" referenced memory at "0x003b9000".The memory could not be "read"
Click on OK to terminate the program
Click on CANCEL to debug the program
我进行debug时弹出文件:memcpy.asm:一个黄色的指针停留在这一句上:
rep    movsd    ;N - move all of our dwords
我也不知道到底是什么地方出问题了?!

解决方案 »

  1.   

    可能越界
    用BOUNDCHECKER调试一下
      

  2.   

    不会用BOUNDCHECKER啊!
    不过我加上一个判断试了试,现在程序倒没有弹出上述窗口,而是直接退出了!
      

  3.   

    这样给string赋值应该是没有问题的吧?
    buf = pTempBuf(pTempBuf是一个char*指针,buf是string类型)
      

  4.   

    tempBuf 这块内存能不能写??buf 是否析构
      

  5.   

    tmepBuf有赋值。
    tempBuf定义为:
    char tempBuf[1024];应该是可以写的啊!
      

  6.   

    Learn are few line of assembly code and look at register values. Most likely buf.c_str() is 0x003b9000 and the adddress is not readable.