数组was corrupted,没有越界。
程序代码:
......
void main_1(int * n_file_, FILE * open, FILE ** file)
{
// FILE *file[9] = { write_8, write_9, write_10, write_11, write_12, write_13, write_14, write_15, write_16 };
char temp[40];
// char *temp = (char *)malloc(sizeof(char)* 40);
int i,j=0,lenth=0,count=0;
while (!feof(open))//判断是否到文件尾部
{
if (j == 0)
count++;
// if (count ==5950275)
// system("pause");
// printf("%d\t",count);
j = 0;
fscanf(open, "%s ", temp);//从文件读取一个字符串
i = length(temp);//根据字符串长度确定输入哪一个文件,若返回值为0,则跳过这个字符串
if (i == 100)//
{
count--;
j = 1;
}
else
lenth = i;
if (lenth == 0)
continue;
else if (lenth < 9)//写入对应的文件
{
file_write(temp, file[0],j);
n_file_[0]++;
}
else if (lenth>15)
{
file_write(temp, file[8],j);
n_file_[8]++;
}
else
{
file_write(temp, file[lenth - 8],j);
n_file_[lenth - 8]++;
}
}
//就是这个地方
}
当count=5950276时出错:
Program:**\.exe
Module:**\.exe
File:
Run-Time Check Failure #2-Stack around the variable 'temp' was corrupted
看了下数组没有越界。在“就是这个地方”停了下来。查了资料,改了project->配置属性->c/c++->代码生成->基本运行时检查 设置为默认值,但是没有用,只是不出现提示框,到了这个值仍然出错。









