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 101 102 103 104 105 106 107 108 109 110 111 112 113
|
#include <stdio.h>
#include <stdlib.h>
/* -ed- pourquoi des globales ?
int c=0 ;
char path[50]= "*" ;
char path2[50][100] ;
char b[100][200], d, f, g, h , a ;
FILE *fp, *fp2[100] ;
*/
/* -ed- le type retourne de main() doit etre explicite (C99) */
int main (void)
{
int c=0 ;
char path[50]= "*" ;
char path2[50][100] ;
char b[100][200], d, f, g, h , a ;
FILE *fp, *fp2[100] ;
if ((fp=fopen (path, "r")) == NULL)
{
printf("Erreur1\n") ;
/* -ed- manque <stdlib.h>
*/
exit(1) ;
}
/* -ed-
while ((a = fget(fp)) != EOF)
fgets() n'existe pas. Tu veux sans doute dire fgets()...
*/
while (fgets (b[c], 200, fp) != NULL)
{
/* -ed-
gets (b[c], 200, fp) ;
Il ne faut pas utiliser gets() qyu est un bug.
De plus, les parametres sont errones. Tu voulais sans doute dire
fgets()...
en fait l'usage veut que l'on place ce fgets() dans le test du while.
*/
d= 97 ;
d= f = g = h ;
/* -ed-
deux affectations successives de la meme variable ?
C'est louche
*/
if (d != 122)
d++ ;
else
{
if (f=122)
{
if(g=122)
/* -ed-
;
En principe, pas de ';' apres un if()...
*/
{
if(h=122)
exit(1) ;
}
}
else
h++ ;
/* -ed on ne sait pas a quel if ces else se referent...
else
g++ ;
else
f++ ;
*/
}
/* -ed-
path2[c] = d ;
path2[c] = f ;
path2[c] = g ;
path2[c] = h ;
path2[c] = "*" ;
path2 etant un tableau de char a 2 diension,
je ne vois pas ce que tu cherches a faire.
En tout cas, c'est plutot
path2[c][...] = d ;
etc.
*/
if ((fp2[c] = fopen(path2[c], "w")) != NULL)
{
/* -ed-
puts (b[c], 200, fp2[c]) ;
mauvais parametres. Tu pensais peut etre a printf () ?
*/
close (fp2[c]) ;
c++ ;
}
else
{
printf("Erreur2\n") ;
exit(1) ;
}
close (fp) ;
}
} |
Partager