如何解决未排序的双链表损坏中止核心转储
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <time.h>
typedef char string [50];
typedef struct adresse{
int zip_code;
string city;
}
adresse Fr[27381996];// I will upload data to this table from the file
int main (){
int i=-1,line_nb=1;
int j=1;
double timing=0.0;//This is for calculating the timing
//These upcoming lines are for opening the file
FILE * France_adr;
France_adr=fopen("france.csv","r");
char adr[300];
for(line_nb=1;line_nb<10;line_nb++)
{
time_t begin= time(NULL);//Here I start the timing
while((!feof(France_adr))&& (i<line_nb))
{
fgets(adr,300,France_adr);
char* s = strdup(adr);
char* val = strsep(&s,","); /* This is because in the file
there are some data that I
don't want to use and they are separated with a comma*/
while(val!=NULL)
{
val=strsep(&s,");
// This is also to sort the data I want to get into my
table
if(j==2 && i!=-1)
{
Fr[i].zip_code=atoi(val);
printf("%d | ",Fr[i].zip_code);
}
j++;
}
i++;
j=1;
printf("\n");
}
fclose(France_adr);
printf("\n\n");
time_t end = time(NULL);
duree += (double)(1000*(end-begin));
//This section is for writing the timing and number of lines into a new
file
FILE * donnee_t;
donnee_t=fopen("Affichage_Donnee_Courbe.csv","a");
fprintf(donnee_t,"\n %d,%f",i,duree);
fclose(donnee_t);
i=0;
}
return 0;
}
我正在处理这个项目,我必须从文件上传大量数据。所以我要做的是在终端上显示这些数据行,看看显示它需要多少时间,并最终创建一条曲线,根据显示的行数显示时间如何演变(所以 我将显示的行数和显示在另一个文件 .CSV 中所花费的时间写下来。而且由于该文件有 2700 万行数据,我想为每次要显示多少行做一个循环,但是终端向我显示了这个错误。我希望我很好地解释了这个问题,我希望我能得到你的帮助。 enter image description here
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。