Strcpy Core Violation nonsense

0

I wanted to ask for help urgently since I'm doing a project and I need to find out where I got my error

my program is supposed to scrap a text and evaluate if there are words that support or attack a candidate (school work)

My problem is that when I put the words to evaluate in a hash table by means of strcpy it executes all my code but it shows me until the end violation of the generated core.

I'm going crazy

I copy my code

  void leerArchivo(Nodo *T, char *dato){
FILE *fpl=0;
fpl= fopen(dato, "r");
char linea[20];
unsigned y;
while (fgets(linea, 20, fpl)){
    fscanf(fpl, "%s", &linea);
    y=H(linea, 300);
    i=0;
    while(T[y % 300].status==1 && i<301){
        y=y+i;
        i++;
    }
    y=y%300;
    T[y].status=1;
    strcpy(T[y].palabra, linea);
    //printf("%s\n",T[y].palabra);
}       
fclose(fpl);
return;
}

In another document I call my code and I put the following

 void leerDoc(Nodo *T,char *dato, nombres *estos){
FILE *fplc=0;
fplc= fopen(dato, "r");
char linea[500];
unsigned y;
while (!feof(fplc)){
    fscanf(fplc, " %s ", &linea);
    y=H(linea, 300);
    for (i=0;i<20;i++){
        if(strcmp(estos[i].nombreCan,linea)==0 ){
            printf("encontre un candidato: %s\n", linea);           
        }
    }
        if(strcmp(T[y].palabra, linea)==0){
        printf("encontre una palabra: %s\n", linea);
    }
}       
fclose(fplc);
return;}

//||strcmp(estos[i].nombreCan,linea)==0
//strcmp(T[i].palabra,linea)==0 ||

int main(){
Nodo *T;
T=initHash();
leerArchivo(&T,"palabras.txt");
nombres *estos;
estos=IniCan();
BuscarCandidatos(&estos, "nombres.txt");
leerDoc(&T,"html2", &estos);
printf("esto deberia salir\n");
return 0;
}
    
asked by Chris Orea 04.04.2018 в 04:30
source

0 answers