定义:
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
我也不知道到底是什么地方出问题了?!
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
我也不知道到底是什么地方出问题了?!
用BOUNDCHECKER调试一下
不过我加上一个判断试了试,现在程序倒没有弹出上述窗口,而是直接退出了!
buf = pTempBuf(pTempBuf是一个char*指针,buf是string类型)
tempBuf定义为:
char tempBuf[1024];应该是可以写的啊!