gpt4 book ai didi

c++ - _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) 错误

转载 作者:行者123 更新时间:2023-11-28 00:07:28 25 4
gpt4 key购买 nike

我在下面代码的最后一行遇到错误“_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)”:

pixelCoorindateAndThreePoint* tempSpace = new pixelCoorindateAndThreePoint[possibleMaxSize];
while (sscanf(temp, "%f %f", &cam1x, &cam1y)){
location = (int)(file->length*cam1y + cam1x);
file->cam1cam2ThreeDPoints[(int)(file->length*cam1y + cam1x)] = new pixelCoorindateAndThreePoint;
sscanf(temp, "%*f %*f %f %f %f %f %f \n",
&(tempSpace->PixelCoordinateCam2.x),
&(tempSpace->PixelCoordinateCam2.y),
&(tempSpace->threePoints.x),
&(tempSpace->threePoints.y),
&(tempSpace->threePoints.z));

file->cam1cam2ThreeDPoints[location] = tempSpace;
tempSpace++;

temp = strtok(NULL, "\n");
}
delete[] tempSpace;

为什么会出现这样的错误?由于我已将这些指针值复制到 file->cam1cam2ThreeDPoints,因此我应该能够删除 tempSpace

最佳答案

tempSpace++; 更改指针。您需要记住最初分配的指针,以便用它调用 delete

关于c++ - _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34722064/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com