これが私のコードです:
    while (fgets(line, 1000, fp) != NULL) 
    { 
      printf("backin!");
      if ((result = strtok(line,delims)) == NULL)
        printf("Need from_id, to_id, and distance on each line of input file.\n");
      else
        from_id = atoi(result);
      printf("check!\n");
      if ((result = strtok(NULL,delims)) == NULL)
        printf("Need from_id, to_id, and distance on each line of input file.\n");
      else
        to_id = atoi(result);
      printf("check!\n");
      if ((result = strtok(NULL,delims)) == NULL)
        printf("Need from_id, to_id, and distance on each line of input file.\n");
      else
        distance = atof(result);
      printf("check!\n");
      printf("from_id: %d, to_id: %d, distance: %f",from_id, to_id, distance);
      if(BuildGraph(graph_array, from_id, to_id, distance) == -1)
        printf("Error while filling in graph type"); 
      printf("check!\n");
    }
これらすべての printfs は、segfault が発生した場所を特定するためのものです。入力ファイルの長さは 100 行で、この関数は 15 回動作し、すべてのチェックを完了してから、"backin!" の前にエラーをセグメント化します。16回目の繰り返しで印刷されます。
入力ファイルを調べたところ、怪しいものは何もありません (間違いなく 1000 文字未満です)。fgets に問題があるようですが、何がわかりません。