Bonjour,
J'ai essayé de lire un fichier .txt afin de stoker ses données dans une matrice .
Pour se faire j’utilise ce code mais ça ne marche pas au bout du debug.
Voila mon 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
#include <stdio.h> 
#include <math.h> 
#include <stdlib.h> 
#include <string.h> 
float output[9][3]; 
FILE *ReadInput; 
double **A;
int i,j ;
 
 
int main (void) 
{ 
    printf("heloword \n");
 
ReadInput = fopen ("torus.txt", "r" ) ; 
if(ReadInput == NULL) 
{ 
printf("Le fichier n'existe pas"); 
} 
else 
{ 
printf("heloword \n");
    for(i=0;i<=9;i++)
    {
     for(j=0;j<=2;j++)
      {
       fscanf_s(ReadInput,"%lf",(A[i]+j));
       printf("heloword2 \n");
      }
    }
  printf("heloword \n");
for(i=0;i<=9;i++)
    {
     for(j=0;j<=2;j++)
     {
       printf("%lf",(A[i][j]));
       printf("   ");
     }
      printf("\n");
   }
   } 
return 1 ; 
}