I am not an expert in programming, but I have some experience. More than a week has passed when I try to read a data file from C into a Fortran program. Program C stores the matrix in a bin-format data file as follows:
FILE * amatFile; amatFile = fopen("A.dat","wb"); for(krowa=0;krowa<N2;krowa++){ fwrite(amat[krowa], sizeof(float), S2, amatFile); } fclose(amatFile);
and my reading section in F90:
open(unit=1,file='AMAT.dat',form='unformatted') DO i = 1,M Do j = 1,N READ(unit=1) AMAT(i,j) A(i,j) = AMAT(i,j) End do End Do close(1)
I really appreciate if you help me solve the problem.
source share