所以这是我的代码,我不断收到分段错误。如何格式化此代码以从文件中读取一组数字?
我的输入如下所示: 82, 46, 71, 56, 44, 12, 100 62, 67, 64, 65, 62, 39, 68 68, 90, 78, 57, 76, 45, 82 等
#include <stdio.h>
int main ()
{
FILE *input = fopen("input.txt", "r");
int line[7];
int store = 0, read;
if(!input)
{
printf("Error: Filename \"input.txt\" not found!\n");
}
store = 0;
while(fscanf(input, "%d", &read) != EOF)
{
line[store] = read;
store++;
}
printf("%d %d %d %d %d %d %d\n", line[0], line[1], line[2], line[3], line[4], line[5], line[6]);
return(0);
}