Saturday, May 22, 2010

What is the other way to do this........in c.........i m using gcc as a compiler?

file(double (*f)[ydim][9],double (*feq)[ydim][9])


{





FILE *fp1;


fp1=fopen("Values1.txt","w");


if (fp1=NULL)


{


puts("Cannot Open File");


exit(1);


}





printf(fp1," %lf %lf ",%26amp;f[xdim][ydim][9],%26amp;feq[xdim][ydim][9])...





fclose(fp1);





return(0);


}











the values to the two 3d arrays are given in previous functions

What is the other way to do this........in c.........i m using gcc as a compiler?
I guess you wanted to use fprintf.


Also any multidimensional aray is stored contiguously in memory.So you can write





fwrite((void*)f,sizeof(float),xdim*ydi... got this 10 from the fact u used 9 for the 3rd index*/,fp1);


This will write the array into the file.


No comments:

Post a Comment