Bonjour
j'ai un petit problème d'affectation d'un mots dans un tableau de char.
voici le code ou j'ai le problème . J'ai réussi à situer la faute mais je n'arrive pas à la corriger.
code :
void selection_aleatoire()
{
short D_shrandom;
int D_inti=0;
char D_chmots[6][20],D_chmot[20];
FILE *D_fichier;
D_fichier= fopen("mots.dat","r");
while(fgets(D_chmot,20,D_fichier)!=0)
{
D_inti++;
strcpy(D_chmots[D_inti],D_chmot); <---erreur ici
"acces violation sous Borland C++ Builder.
printf("%s",D_chmots[D_inti]);
}
fclose(D_fichier);
getch();
randomize;
D_shrandom=random(6);//D_shrandom = ((rand()+time(NULL))%20);
strcpy(D_chmot,D_chmots[D_shrandom]);
printf("%s",D_chmot);
getch();
}
Merci d'avance pour votre aide.
++All