Bonjour,

Tout d'abord, voici le code :

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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
void ImpDiffUnComp( char *TypCompImp, char AttrImp, tSchema *SchemaPtr, tSchema *Schema2Ptr, int TypeDiff, ListeDetail *liste, Tableau_Recap *recap )
{
	/* variables locales */
	tBoolean SousType;
	tBoolean PremEquiv; /* premier d'une liste de composants equivalents avec
                          numero consecutifs ( pour les 2 schemas )           */
	int 	PremInd;   	/* indice du 1er composant a traiter dans TabSchema */
	int 	DernInd;   	/* indice du dernier composant a traiter dans TabSchema */
	int 	IndTab;    	/* indice courant dans le tableau */
 
	/* corps fonction */
	/* entete suivant le type de composant et l'attribut */
	TeteEltDiff ( TypeDiff );
	PremEquiv = FALSE;
 
	char* test;
 
	int i = initialiser_Detail(TypeDiff, liste, recap);
	char *remplissage_donnees[i];
	int cpt = 0;
	remplissage_donnees[0] = "test";
	/* Intervalle du tableau des composants suivant le type de composant */
	/* un sous type existe pour les E/S */
	switch (TypeDiff/10)
	{
	case 0 :
	case 2 :
		SousType = TRUE;
		IntervTab ( ENTREE, SchemaPtr, &PremInd , &DernInd );
		break;
 
	case 7 :
		SousType = FALSE;
		IntervTab ( EDV, SchemaPtr,	&PremInd , &DernInd );
		break;
 
	case 1 :
	case 3 :
		SousType = TRUE;
		IntervTab ( SORTIE, SchemaPtr, &PremInd , &DernInd );
		break;
 
	case 5 :
	case 6 :
		SousType = TRUE;
		IntervTab ( STATION, SchemaPtr,	&PremInd , &DernInd );
		break;
	case 4 :
		SousType = FALSE;
		IntervTab ( OPERATEUR, SchemaPtr, &PremInd , &DernInd );
		break;
	}
 
	for ( IndTab = PremInd; IndTab <= DernInd; IndTab ++ )
	{	
		if ( (SchemaPtr->TabSchema[IndTab].Attribut == AttrImp ) &&
				( (SousType == FALSE ) ||
						(SchemaPtr->TabSchema[IndTab].TypeComposant[1] == TypCompImp[1])
				)   )
		{
			if (AttrImp == 'E')  /* equivalents, on n'imprime que le 1er d'une
                               liste consecutives de composants */
			{
				if ( PremEquiv == FALSE )
				{
					test = ImpLigDiff( SchemaPtr, Schema2Ptr, IndTab, TypeDiff );
					printf("test : %s\n",test);
					PremEquiv = ListeEquiv ( SchemaPtr, IndTab, DernInd );
					PremEquiv = FALSE;
					/* Modif Th.P car non comprehensible sur listing
                 if ( PremEquiv == TRUE )
                 ImpLigTab ("...|...|...");      */
				}
				else
					if ( ListeEquiv ( SchemaPtr, IndTab, DernInd ) == FALSE )
					{
						test = ImpLigDiff( SchemaPtr, Schema2Ptr, IndTab, TypeDiff );
						printf("test : %s\n",test);
						/* Modif Th.P car non comprehensible sur listing
                   PremEquiv = FALSE;            */
					}
			}
			else
			{
				test = ImpLigDiff( SchemaPtr, Schema2Ptr, IndTab, TypeDiff );					
				printf("test : %s\n",test);
			}
			remplissage_donnees[cpt] = test;
			cpt++;
		}
	}	
	int j;
	for (j = 0;j<i;j++){
		printf("TAB : %s\n",remplissage_donnees[j]);
	}
	FermerTableau();
	SautLigne(4);
 
	return;
}
Je souhaite récupérer une chaîne de caractères via la fonction ImpLigDiff dans un char* test.
( la fonction renvoie bien elle aussi, un char* )
Une fois cette ligne récupérée, je la mets dans un tableau (remplissage_donnees) de type char**.
Le problème est qu'à la fin (lorsque je boucle sur le tableau avant de sortir de la fonction), toutes les lignes sont écrasées par la dernière ligne reçue
Pourtant le compteur augmente bien, j'ai vérifié....
et les printf("test..) donne bien à chaque fois une chaîne différente...

Auriez-vous une idée du problème ?

Merci d'avance