I keep getting a seg fault at the end of a file read. Each line of the file is around 500+ characters so MAX_LEN is 600. Any ideas?
Code:
//~ _________________________________________________
//~ Read GIS data
void read_gis(char *gis,GooCanvasItem *canvas)
{	
	FILE * gis_file;
	//~ gchar *path_data;
	char path[MAX_LEN + 1];
	int count = 0;
	size_t i;
    
	gis_file = fopen(gis,"r");
	if (gis_file != NULL)
	{
		while ( fgets(path, MAX_LEN+1, gis_file) != NULL )
		{
			count++;
			printf("%d %s\n\n",count,path);
			i = strlen(path);
			printf("strlen %d\n",i);
			path[i+1] = '\0';
			
		
			//~ path_data = path;
			//~ goo_canvas_path_new(canvas,path_data,"stroke-color","white","line-width",5.0,NULL);
			//~ goo_canvas_path_new(canvas,"M 20,20 L 4000,4000","stroke-color","white","line-width",5.0,NULL);
		}
	}
	fclose (gis_file);
}