テキスト ファイルからデータを読み取り、その値を配列に格納するコードを以下に記述しました。私のコードはファイルを読み取っていません。
使用されているライブラリ ヘッダー
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <conio.h>
私のメイン
int main()
{
FILE *fpoo;
float NumArr[5];
//「c:\Fly_u.txt」も同様に試しました
fpoo= fopen ("Fly_u.txt","r");
if(fpoo!=NULL)
for (int i=0;i<6;i++)
{
fscanf(fpoo,"%d\n",NumArr[i]);
{
else
{
printf("me");
}
for (int i=0;i<6;i++)
{
printf("%f",NumArr[i]);
}
fclose(fpoo);
_getche();
return 0;
}
//テキストファイルの内容は以下の通り
0.99247
0.14727
-0.00041387
-1.737
0.20475
-0.052151
0.14755
-0.0233
-0.32606
0.092085
0.059199
-0.025587
0.0097565
0.13639
0.12007