Need help reading file data
- From: Tom <herofmm@xxxxxxxxx>
- Date: Sun, 30 Sep 2007 17:49:44 -0000
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);
}
---------------------------------------------------------------------------------------------
.
- Prev by Date: Re: Should we broaden the topicality of this group?
- Next by Date: Re: typedef with function pointers
- Previous by thread: Need help in Global variable in c
- Next by thread: free(): invalid pointer:
- Index(es):
Relevant Pages
|