Cとの共同作業.
OK、これはおそらく明らかなことですが、何らかの理由で、私のプログラムは.dat入力ファイルからすべての値を出力するのではなく、特定の数の値のみを出力します。コードは次のとおりです。
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int N = 0;
int j;
float i;
const char Project_Data[] = "FloatValues.dat";
FILE *input = fopen(Project_Data, "r");
if(input != (FILE*) NULL)
{
while(fscanf(input, "%e", &i) == 1)
{
printf("%e\n",i);
++N;
}
printf("\t The number of values in this file is: %d\n", N);
fclose(input);
}
else
printf("Input file could not be read.\n");
return(0);
}
ええ、約 100000 個の値が出力されますが、20000 個しか取得できないようです。ファイル内の値は順番に並べられており、コンパイラはファイルの末尾近く、約 80000 個の後にのみ出力を開始するようです。だから値。
私が間違っているところを知っている人はいますか?