Bonjour,
A partir d'un fichier.txt, j'extrait les valeurs en utilisant char (chaine de caractère) que je nomme tampon.
Voici mon code
Grace à strtof , je convertit la chaine en float. Je cré ensuite un tableau pour stocker mes floats.
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 float f1, f2, f3,f4,f5; f1 = strtof (tampon, &pEnd); f2 = strtof (pEnd, &pEnd); f3 = strtof (pEnd, &pEnd); f4 = strtof (pEnd, &pEnd); f5 = strtof (pEnd, NULL ); /* /\* printf ("%f %f %f", f1 ,f2,f3); *\/ */ float tab[n+50][5]; tab[i][0] =f1; tab[i][1] =f2; tab[i][2] =f3; tab[i][3] =f4; tab[i][4] =f5;
Or lorsque le fichier est très grand, plusieurs milliers de lignes, j'ai le message d'erreur suivant qui apparait :Erreur de segmentation ./$TEST_EXEC.
Merci pour votre aide
Partager