因此,我正在尝试将 .s19 文件中的 s 记录加载到内存中,以用于我正在处理的任务及其工作。但是,当我从我的代码中删除一个未使用的数组时,一切都会停止工作并崩溃。
未使用的数组是:
char test[65536];
这是我写的加载器:
void loader(FILE * srec)
{
char instring[SREC_LEN];
char test[65536]; // This isn't used, but the program crashes without it for some reason
int i=0;
int j=0, k,l;
while (fgets(instring, SREC_LEN, srec) != NULL)
{
while(instring[i] != '\n') // Counts the characters in the s-record
{
i++;
}
j = j+i;
for(k=0;k<=i;k++) // Puts the records into memory
{
memory[l] = instring[k];
l++;
}
l = j;
}
#ifdef DEBUG
printf("MEMORY: %s",memory);
#endif // DEBUG
}
如果您能帮助我理解为什么会发生这种情况,我将不胜感激。