导致访问冲突
Devil iluErrorString() causing access violation
本文关键字:访问冲突 更新时间:2023-10-16
请看我第一天使用vc++的结果。它包含一个我知道的错误。我的问题是,魔鬼出现了一个错误,因为它应该是,但试图解码这个错误到一个字符串使用iluErrorString()导致访问冲突…
#pragma comment(lib, "ILU.lib")
#pragma comment(lib, "ILUT.lib")
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <IL/il.h>
#include <IL/ilu.h>
#include <IL/ilut.h>
using namespace std;
int main(){
FILE *myFile;
ILuint fileSize;
ILubyte *Lump;
ilInit();
ILuint ImageName; // The image name to return.
ilGenImages(1, &ImageName); // Grab a new image name.
ilBindImage(ImageName); //bind the image
myFile = fopen("C:/Documents and Settings/Bartjan/Desktop/c++ meuq/test/Debug/image.png", "r"); //open the file for reading
if (myFile != NULL){
fseek(myFile, 0, SEEK_END); //get file size
fileSize = ftell(myFile);
Lump = (ILubyte*)malloc(fileSize); //allocate mem
fseek(myFile, 0, SEEK_SET); //set the file pointer
fread(Lump, 1, fileSize, myFile); //read the entire file into mem
fclose(myFile);
ilLoadL(IL_PNG, Lump, fileSize);
free(Lump);
}
ilDeleteImages(1, &ImageName); //delete the image
ILenum error;
while ((error = ilGetError()) != IL_NO_ERROR) {
cout << error << ": " << iluErrorString(error);
}
_getch();
return 0;
}
它咳出一个错误1285表示它不理解这个:
ilLoadL(IL_PNG, Lump, fileSize);
我知道这一点。问题在这里:
cout << error << ": " << iluErrorString(error);
这会导致访问冲突,我不知道为什么?
如果您没有像初始化ILU那样初始化ILU,则会出现此问题:
iluInit();
这是因为iluErrorString和ilGetString一样总是返回0。
相关文章:
- 写入位置0x0000000C时发生访问冲突
- 引发异常:读取访问冲突**dynamicArray**为0x1118235.发生
- 链表中写入访问冲突的未知原因
- C++中的openCV Mat访问冲突
- C++尝试深度复制唯一指针时出现内存访问冲突
- C++ 中动态二维数组的访问冲突
- 从嵌套循环中的 std::list 中删除将返回访问冲突
- 写入访问冲突异常
- 在类 12.exe 中0x7B37FF80 (ucrtbased.dll) 引发异常: 0xC0000005:访问冲突读
- 0xC0000005:访问冲突写入位置0xCDCDCDCD动态分配错误
- 读取访问冲突.这0xCDCDCDCD
- 0xC0000005:访问冲突读取位置 0x00000000. 重载 == 运算符的问题
- 插入数组时违反写访问冲突
- 使用 ReadProcessMemory 获取字符串值的访问冲突
- 尝试通过共享指针使用变量时读取访问冲突
- 堆栈上的 C++ 访问冲突写入异常
- 引发异常:写访问冲突. temp 为 nullptr
- 将静态字符数组中的字符分配给动态分配的字符数组 - 访问冲突
- 在C++中删除双向链表的头节点后出现访问冲突异常
- C++ 读取访问冲突,0xCDCDCDCD