Bonjour à tous!
Je bloque sur une erreur qui apparaît lors de l’exécution du programmes mais cette erreur n’empêche pas le bon affichage des valeurs de celui-ci du coup je ne comprend pas vraiment d’où elle vient et ce qu'elle veut dire.

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
78
79
80
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
typedef struct{
	char mat[5];
	int coeff;
	char design[32];
}Mat;
 
Mat lireMat(FILE *flot){
	Mat m;
	fscanf(flot,"%s%d%*c",m.mat,&m.coeff);
	fgets(m.design,32,flot);
	m.design[strlen(m.design)-1]='\0';
 
	return m;
}
 
int chargeFmatieres(char* nomFich, Mat* tMat[ ], int taillemax){
	Mat m;
	FILE *flot;
	int i=0;
 
	flot=fopen(nomFich,"r");
 
	if(flot==NULL){
		printf("Problème d'ouverture du fichier en mode lecture\n");
		return -1;
	}
 
	m=lireMat(flot);
 
	while(!feof(flot)){
		if(i==taillemax){
			printf("Problème le tableau est trop petit !\n");
			return -2;
		}
		tMat[i]=(Mat *)malloc(sizeof(Mat));
 
		if(tMat[i]==NULL){
			printf("Problème d'allocation !\n");
			fclose(flot);
			return -3;
		}
		*tMat[i]=m;
		i++;
		m=lireMat(flot);
	}
	fclose(flot);
	return i;
}
 
void afficheMat(Mat** tMat, int nbmat){
	int i=0;
	for(i=0;i<nbmat;i++){
		printf("%s\t%d\t%s\n",tMat[i]->mat,tMat[i]->coeff,tMat[i]->design);
	}
	printf("\n");
}
void testCharge (void){
	Mat *tMat;
	char nomFich[20];
	int nbmat;
 
	printf("Rentrez un nom de fichier !");
	scanf("%s%*c",nomFich);
 
	nbmat=chargeFmatieres(nomFich,&tMat,300);
 
	afficheMat(&tMat,nbmat);
 
	free(tMat);
}
 
int main(void){
	testCharge();
	return 0;	
}
affichage :

Rentrez un nom de fichier !fmat.don
acsi1	4	analyse et conception
algo1	4	algorithmique période 1
algo2	4	algorithmique période 2
based	4	base de données
maths	2	mathématiques
organ	2	organisation

*** stack smashing detected ***: terminated
Abandon (core dumped)
Merci pour toute aide !