だから私は、私が取り組んでいる課題のために.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
}
なぜこれが起こっているのかを理解するのを手伝っていただければ幸いです。