Bonjour,

Voila mon probleme : lorsque je compile ce code, ça passe, mais à l'execution, ça sort : "erreur de segmentation".
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
 
#include <stdio.h>
#include <string.h>
#define FICH_IR "ir.edt"
#define NBE_LINE_TAB 5
#define NBE_COL_TAB 3
#define LINE_SIZE 9
 
void initTabMat (char tabMat[NBE_LINE_TAB][NBE_COL_TAB][LINE_SIZE], char nomFich[]){
 
	//variables locales
	FILE * fich;
	FILE * fichFil;
	char ligne[LINE_SIZE];
	int ind = 0;
	char tabFil[NBE_LINE_TAB][NBE_COL_TAB][LINE_SIZE];
	int i;
	int j;
 
	//debut
	fich = fopen("ens.edt","r");
	fichFil = fopen(nomFich,"r");
 
	while(fgets(ligne, sizeof(ligne), fichFil) != NULL){
		strncpy(tabMat[ind][0], ligne, 4);
		tabMat[ind][0][4] = '\0';
		tabMat[ind][1][0] = ligne[5];
		tabMat[ind][1][1] = '\0';
		tabMat[ind][2][0] = '\0';
 
		//printf("%s",ligne);
		ind++;
	}
 
	ind = 0;
 
	while(fgets(ligne, sizeof(ligne), fich) != NULL){
		strncpy(tabFil[ind][0], ligne, 4);
		tabFil[ind][0][4] = '\0';
		tabFil[ind][1][0] = ligne[5];
		tabFil[ind][1][1] = ligne[6];
		tabFil[ind][1][2] = '\0';
		tabFil[ind][2][0] = '\0';
		ind++;
	}
	for(i = 0 ; i < NBE_LINE_TAB ; i++){
		for(j = 0 ; j < NBE_LINE_TAB ; i++){
			if(strcmp(tabMat[i][0],tabFil[j][0]) == 0){
				strcpy(tabMat[i][2], tabFil[j][1]);
			}
		}
	} 
 
	fclose(fichFil);
 
	fclose(fich);
 
}
 
 
 
void testAffich(char tabMat[NBE_LINE_TAB][NBE_COL_TAB][LINE_SIZE]){
 
	int i;
 
	for(i = 0; i < 5; i++){
		printf("%s %s %s\n", tabMat[i][0], tabMat[i][1], tabMat[i][2]);
	}
}
 
 
int main(){	
 
	char tabMat[NBE_LINE_TAB][NBE_COL_TAB][LINE_SIZE];
	initTabMat(tabMat, FICH_IR);
	testAffich(tabMat);
}
Je ne voi pas d'ou vien l'erreur... Une idée?