积极答复者
异常

问题
-
代码:
#include "stdafx.h"
struct Data
{
GLint x;
GLint y;
GLint z;
};
GLint glz;
int main(Data point[6000][6000])
{
char *filepath;
filepath = "Data/srtm_59_06.asc";
FILE *filename;
fopen_s(&filename,filepath, "r");int ncols = 0, nrows = 0;
fscanf_s(filename, "%d", ncols);//列
fscanf_s(filename, "%d", nrows);//行int xllcorner = 0, yllcorner = 0;
fscanf_s(filename, "%d", xllcorner);//宽
fscanf_s(filename, "%d", yllcorner);//高double cellsize = 0;
int NODATA_value = 0;
fscanf_s(filename, "%If", cellsize);
fscanf_s(filename, "%d", NODATA_value);int i, j;
for (i = 0; i <= 5999; i++)
{
for (j = 0; j <= 5999; j++)
{
fscanf_s(filename, "%d", point[i][j].z);
}
j = 0;
}fclose(filename);
return 0;
}错误:
0x01331557 处有未经处理的异常(在 读文件代码测试.exe 中): 0xC0000005: 读取位置 0x00000009 时发生访问冲突。
- 已编辑 hi,哥们儿 2013年11月13日 12:28
答案
-
你好,
“0xC0000005: 读取位置 0x00000009 时发生访问冲突” 通常表示使用了未创建(未分配内存空间)的变量或对象,是内存访问错误引起的, 可能是你的程序有错误的指针操作或者访问了空对象,建议你设置断点调试程序从而定位到报错的语句,然后查看相应语句的地方有没有内存分配问题或此处涉及的变量有无问题。
Data point [6000][6000] 在你提供的代码片段中好像没有分配内存。
另外,你是否包含所有需要的opengl头文件,因为这个在你的代码中没有看到。
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 May Wang - MSFT 2013年11月21日 3:04
全部回复
-
你好,
“0xC0000005: 读取位置 0x00000009 时发生访问冲突” 通常表示使用了未创建(未分配内存空间)的变量或对象,是内存访问错误引起的, 可能是你的程序有错误的指针操作或者访问了空对象,建议你设置断点调试程序从而定位到报错的语句,然后查看相应语句的地方有没有内存分配问题或此处涉及的变量有无问题。
Data point [6000][6000] 在你提供的代码片段中好像没有分配内存。
另外,你是否包含所有需要的opengl头文件,因为这个在你的代码中没有看到。
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 May Wang - MSFT 2013年11月21日 3:04
-
你好,
请你参考以下资料学习二维数组的内存分配方法。
http://www.docin.com/app/p?id=80970206
希望对你有帮助!
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已编辑 May Wang - MSFT 2013年11月18日 7:55