Voila je comprend vraiment pas, dés la premiere ligne de mon code j'ai une segmentation fault, alors que cette ligne est un printf
Si vous pouviez m'aider merci encore.
Par contre je crois qu'en standar la librairie regex.h n'est pas installé avec windows, et j'utilise aussi un tree-tagger pour linux.
#include <sys/types.h>
#include <regex.h>
#include <search.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TAILLE_TAMPON 500
#define FICHIER_PATRON "fpatron.txt"
struct list {
char *rep;
struct list *suivant;
};
typedef struct list ListRep;
typedef struct questionReponse {
char *expReg;
regex_t expRegComp;
int *corresp;
ListRep *listRep;
ListRep *derniereRep;
struct questionReponse *suivant;
} QuestionReponse;
/*typedef struct questionReponse QuestionReponse;*/
/*char Info[];*/
QuestionReponse *tabStruct = NULL;
/*void nomVar(char *chaine, int tab[]);*/
void RemplirTabStruct ()
{
FILE *Fpatron;
QuestionReponse *marqueur = NULL;
int taillePhrase;
int resultat;
char *tampon = NULL;
int nbligne;
ListRep *reponse = NULL;
printf("je t emmerde" );
Fpatron = fopen(FICHIER_PATRON, "r" );
tampon = malloc(TAILLE_TAMPON*(sizeof(char )));
tabStruct = (QuestionReponse *) malloc(sizeof(QuestionReponse));
marqueur = tabStruct ;
while (!feof(Fpatron))
{
taillePhrase = 0;
fgets(tampon, TAILLE_TAMPON, Fpatron);
while ( *(tampon+taillePhrase) != '\n' && *(tampon+taillePhrase) != '\0')
{
taillePhrase++;
}
strcpy(marqueur->expReg, tampon);
marqueur->expReg = (char *)malloc(taillePhrase*(sizeof(char)));
resultat = regcomp(&(marqueur->expRegComp), marqueur->expReg, REG_EXTENDED);
if (resultat != 0)
{ /* erreur! */
printf("\nError while compiling the RE: " );
switch(resultat) {
case REG_BADBR:
printf("invalid '\\{...\\}' construct in the RE.\n" );
break;
case REG_BADPAT:
printf("syntax error in the RE.\n" );
break;
case REG_BADRPT:
printf("a repetition operator such as ? or * appeared in a bad position.\n" );
break;
case REG_ECOLLATE:
printf("the RE referred to an invalid collating element.\n" );
break;
case REG_ECTYPE:
printf("the RE referred to an invalid character class name.\n" );
break;
case REG_EESCAPE:
printf("the RE ended with '\\'.\n" );
break;
case REG_ESUBREG:
printf("there was an invalid number in the '\\digit' construct.\n" );
break;
case REG_EBRACK:
printf("there were unbalanced square brackets in the RE.\n" );
break;
case REG_EPAREN:
printf("there were unbalanced parentheses in the RE or '\\(' and '\\)'.\n" );
break;
case REG_EBRACE:
printf("there were unbalanced '\\{' or '\\}' in the RE.\n" );
break;
case REG_ERANGE:
printf("one of the endpoints in a range expression was invalid.\n" );
break;
case REG_ESPACE:
printf("refcomp or regexec ran out of memory.\n" );
break;
default:
printf("autre erreur.\n" );
}
}
fgets(tampon, TAILLE_TAMPON, Fpatron);
/*nomVar(tampon, *marqueur->corresp);*/
nbligne = 0;
fgets(tampon, TAILLE_TAMPON, Fpatron);
reponse = marqueur->listRep;
while (*tampon != '\n' && *tampon !='\0')
{
reponse = malloc(sizeof(ListRep));
taillePhrase = 0;
while ( *(tampon+taillePhrase) != '\n')
{
taillePhrase++;
}
reponse->rep = malloc(taillePhrase*(sizeof(char)));
strcpy(reponse->rep, tampon);
fgets(tampon, TAILLE_TAMPON, Fpatron);
reponse = reponse->suivant;
}
marqueur->derniereRep = marqueur->listRep;
Fpatron ++;
marqueur = marqueur->suivant;
marqueur = (QuestionReponse *) malloc(sizeof(QuestionReponse));
}
}
void main (){
printf("fais qqq chose connard" );
RemplirTabStruct ();
printf("je me fou de ta geule violement" );
printf(" %s \n", tabStruct-> expReg);
printf("j en ai marre" );
}