bonsoir ,je veux faire un tri par ordre décroissant a partir d'un fichier qui contient des valeurs(lecture),ces valeurs seront trié dans un autre fichier(en ecriture).
voila mon code je ne sais pas ou est l'erreur,ces valeur s’écrit dans le nouveau fichier mais pas avec l'ordre décroissant.

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
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int main()
{
 
  char FICH_A[30], FICH_FUS[30];
  FILE *FA,*FFUS;
  void tri(int* TABA,int N);
int changer_pos(int *tabl1, int *tabl2);
 
 
 
 int TABA[100],TFUS[200];
  int LA,N,I ; 
do
    {
 
     FA = fopen("D:\\tester.txt", "r");
     if (!FA) 
         printf("\aERREUR: Impossible d'ouvrir "
                "le fichier: ");
    }
  while (!FA);
 
  for (LA=0; !feof(FA); LA++)
       fscanf(FA,"%d\n", &N);
        while (!feof(FA))
     putchar(fgetc(FA));
 
 
 
  fclose(FA);
 
 
  FA = fopen("D:\\tester.txt", "r");
 
  for (I=0; I<N; I++)
       fscanf(FA,"%d\n", TABA+I);
 
  fclose(FA);
 
do
    {
 
 
  FFUS = fopen("D:\\tester3.txt", "w");
 
     if (!FFUS) 
         printf("\aERREUR: Impossible d'ouvrir "
                "le fichier: %s.\n", FICH_FUS);
    }
  while (!FFUS);
 
  for (I=0; I<LA; I++)
       fprintf(FFUS,"%d\n", *(TABA+I));
        for (I=0; I<LA; I++)
       printf("%d\n", *(TABA+I));
 
 
  fclose(FFUS);
  getch();
   return 0;
}
void tri(int* TABA,int N)
{
    int i, _i;
    for(_i=0;_i<N;++_i)
    {
        for(i=0;i<N-1;i++)
        {
            if(TABA[i] > TABA[i+1])
            {
            int  changer_pos(int *tabl1, int *tabl2);
            printf ("%d",&TABA[i]);
            }
        }
    }
}
 
 
 
int changer_pos(int *tabl1, int *tabl2)
{
    int inter = 0;
 
    inter = *tabl1;
    *tabl1 = *tabl2;
    *tabl2 = inter;
}
merci d'avance.