Miximum matrix size? / reading big arrays of data
Dear All,
Please help me with my problem. In my program I need to open many files with numbers and read these numbers to the matrix. I am able to open only 22 files and when I try to open next one, I have a error message Segmentation fault. There is no problem in file. I create them in same way and if I double timestep I can pass the file where reading stops, but again stops after 22 files. Is there a limitation to the size of the matrix?
I will be very grateful for any help.
In ascii file I have first line with char symbol (I read it to the char variable). Then I have lines with double float type number (6 in one line). Below is an example.
insert
Code:
C
16.645432 7.813343 15.514420
16.665323 8.334960 15.687680
14.005162 7.725507 16.015217
I create a matrix.
incert
Code:
double CRx[N_molC][N_beadC][N_files];
double CRy[N_molC][N_beadC][N_files];
double CRz[N_molC][N_beadC][N_files];
Then I read numbers to matrix.
incert
Code:
t=0;
while(t<N_files)
{
for( j=0; j < N_molC; j++)
{
for( i=0; i < N_beadC; i++)
{
fscanf(fp,"%f",&tmpfloat1);
fscanf(fp,"%f",&tmpfloat2);
fscanf(fp,"%f",&tmpfloat3);
fscanf(fp,"\n");
CRx[j][i][t]=(double) tmpfloat1;
CRy[j][i][t]=(double) tmpfloat2;
CRz[j][i][t]=(double) tmpfloat3;
}
}
fclose(fp);
t=t+1;
}