fp | 読み込むファイルのファイルポインタ。 The file pointer of a file to read. |
correct_number_of_column | 読み込む行の正しい列数。 The correct number of columns for the line to read. |
|
int N=1024; int n; double frequency[N],spectrum_r[N],spectrum_i[N]; FILE ∗fp=fopen("data.dat","r"); for(n=0;n<N;n++){ fscanf(fp,"%lf%lf%lf", &(frequency[n]),&(spectrum_r[n]),&(spectrum_i[n])); } fclose(fp); |
int N=1024; int n; double frequency[N],spectrum_r[N],spectrum_i[N]; char ∗∗data_tmp; FILE ∗fp=fopen("data.dat","r"); for(n=0;n<N;n++){ data_tmp=read_and_decompose_line(fp,3); frequency[n]=atof(data_tmp[0]); spectrum_r[n]=atof(data_tmp[1]); spectrum_i[n]=atof(data_tmp[2]); free2(&data_tmp,3); } fclose(fp); |