1

Salut voila ca fait 2 jours que je m'acharne sur ce probleme, voila en rouge je declare A et je voudrais que la fonction ecrit_liste avec comme param le pointeur tab qui est appelle par gerer_liste pointe vers cette putain de variable A de merde j'ai essaye plein de truc ca marche pas donc si vous pouvez m'aider ca tuerais tout.

void ecrit_liste(char *tab,short h,short decal)
{
short i=0;

SetPlane(DARK_PLANE);
for (i = 1; i < h+1; i++)
{
DrawStr(10, ((i*8)-5), (char *)tab[(i+decal)] , A_XOR);
}
SetPlane(LIGHT_PLANE); // Active le plan gris clair
for (i = 1; i < h+1; i++)
{
DrawStr(10, ((i*8)-5), (char *)tab[(i+decal)] , A_XOR);
}
}


void gere_liste(int M,int N)
{
short i=0, hauteur=0;
short int sel=1, pos=1, decalage=0;
short keymusic=0;
char (*A)[N] = calloc(M*N,sizeof(char *));

if (M>12) {hauteur=12;} else {hauteur=M;}

FontSetSys(F_4x6);

strncpy((char *)A[1], "1abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[2], "2abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[3], "3abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[4], "4abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[5], "5abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[6], "6abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[7], "7abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[8], "8abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[9], "9abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[10], "10abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[11], "11abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[12], "12abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[13], "13abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[14], "14abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[15], "15abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[16], "16abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[17], "17abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[18], "18abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[19], "19abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[20], "20abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[21], "21abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[22], "22abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[23], "23abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[24], "24abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[25], "25abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[26], "26abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[27], "27abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[28], "28abcdefghijklmnopqrstuvwxyz", N+1);
strncpy((char *)A[29], "29abcdefghijklmnopqrstuvwxyz", N+1);


ecrit_liste(&A,hauteur,decalage);

...
}

2

Bon, déjà, tu oublies de vérifier malloc ne renvoie pas NULL.

Ensuite, ta fonction, tu la réécris comme ça :
ecrit_liste(char **tab,short h,short decal,short nbcol)
{
DrawStr(x,y,tab[(i*nbcol)+decal],attr);
}

tu l'appelles comme ça : ecrit_liste(A,heuteur,decalage,N);

Il y a une technique qui permet de ne pas avoir à utiliser nbcol (c'est le compilo qui gère directement), mais j'ai oublié.
Kevin passera p-ê par ici et nous aidera.
c'est un truc du genre :
ecrit_liste(short N ; char (*tab)[N],short hauteur, short decalage);

3

J'ai toujours le meme message d'erreur : passing arg 1 of 'ecrit_liste'from incompatible pointer type

Sur chaque appel de la fonction ecrit_liste en gros quand j'ecris
ecrit_liste(A,hauteur,decalage,N); il aime pas le A

4

typecast ...

ecrit_liste((char **)A,hauteur,decalage,N);

5

void ecrit_liste(int N, char (*tab)[N],short h,short decal)
{
...
}

void gere_liste(int M,int N)
{
short i=0, hauteur=0;
short int sel=1, pos=1, decalage=0;
short keymusic=0;
char (*A)[N] = calloc(M*N,sizeof(char *));
...
ecrit_liste(N,A,hauteur,decalage);

...
}
avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité

6

Merci pour tout la sol de Neurone associe a celle de Jackiechan marche ainsi que celle de Kevin

Yahoooooooooooooooooooo!!!!!!!

7

nan google c mieux picol

8

Nerick a écrit :
nan google c mieux picol


Google powaaaaaaaa!
Boogerman

Bouger, travailler, manger et se reposer, c'est la devise de la tortue!

9

prend la méthode de Kevin .... roll

10

Oui, celle de kevin, sera sûrement plus simple à utiliser.