Need help reading file data



I have a datafile which has a form of

10.10 10.20 10.30 ...
20.10 20.20 20.30 ...
30.10 30.20 30.30 ...
.. . .
.. . .
.. . .

it has 500 rows and 10002 colums.

I tried to read the whole data in a single variable.
My pc shows error. (Windows XP, notebook)

All I need is to read each column data and do some integration.
and so on for every colum.

my naive code is following but, it is too slow.
(it is also limited to read first column, but have to expand to read
every column)

---------------------------------------------------------------------------------------------
FILE *fp;
float b;
int i,j;
float a[500];

fp = fopen("2Dwedge_V1_Ga2.36_st6.28_K1.06_B4.00_e0.20posi.dat","r");

for(i=0;i<=499;i++)
{
fscanf(fp,"%f",&(a[i]));

for(j=1;j<=10002;j++)
{
fscanf(fp,"%f",&b);
}

Dosomethingwith(float a, 500);
}
---------------------------------------------------------------------------------------------

.



Relevant Pages

  • Re: Need help reading file data
    ... it has 500 rows and 10002 colums. ... loaded in memory as float or double for a total of 20 or 40 megabytes. ... (it is also limited to read first column, but have to expand to read ... int i,j; ...
    (comp.lang.c)
  • Re: Need help reading file data
    ... it has 500 rows and 10002 colums. ... (it is also limited to read first column, but have to expand to read ... float a; ... This loop will try to read the next 10002 columns of the record. ...
    (comp.lang.c)
  • Re: Need help reading file data
    ... it has 500 rows and 10002 colums. ... (Windows XP, notebook) ... float a; ...
    (comp.lang.c)
  • Re: Need help reading file data
    ... it has 500 rows and 10002 colums. ... (Windows XP, notebook) ... (it is also limited to read first column, but have to expand to read ... float a; ...
    (comp.lang.c)