Retourner au contenu associé (entrée de forum : Lecture d'un fichier texte par colonne (débutant))
Posté par elloco le 06 mars 2005 à 19:14. En réponse au message Lecture d'un fichier texte par colonne (débutant). Évalué à 2.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
[^] # Re: re
Posté par elloco . En réponse au message Lecture d'un fichier texte par colonne (débutant). Évalué à 2.
je n'ai pas essayé si ça compilais ni même si ça marchais mais cela devrait te permettre de t'approcher d'une solution fonctionnelle.
#include <stdio.h>
int main()
{
FILE *fp;
int i = 0;
float nombre1, nombre2;
float tab1[200];
float tab2[200];
fp = open("data.dat","r");
if (f != NULL)
{
while(fscanf(fp, "%f %f", &nombre1, &nombre2) != EOF)
{
tab1[i] = nombre1;
tab2[i] = nombre2;
i += 1;
}
}
return 0;
}