I'm trying to read a huge (1024^3 real*4 elements) binary file written in fortran with these lines
do k = 1,kmax
cubevx(i,j,k) = vx(k+jmax*(j-1)+imax**2*(i-1))
write(*,*)' vx array -> binary cube...',100*i/imax,'%'
write(*,*)'Writing binary file...',100*i/imax,'%'
write(*,*)'data written at ',file2
I'm trying to do this from a C program with the followings lines
fread(&lenght,sizeof(long long int),1,arch1);
printf("Reading bin file...\\n");
The code works ok for small arrays of number_elements<~800^3, but for
these huge 1000^3 file I'm getting bad answers (I'm computing a fft).
I computed the fft from the ascci version of the same file and I got
goods results (of course in much more time), so I'm thinking that due to
some reason I'm not reading the bin file in a good way.
The bin file has 4294967320 bytes = 1024^3 x 4 bytes + 24 bytes.
When I read the first 12 bytes with both a long int and a long long int I
get this number 4310503010900901897. I don't know how to understand it,
it is very diferent from 1024^3.
Thank you in advance.