Posted by: |<1$|-| July 14, 2007
c++ question to programmers ----
Login in to Rate this Post:     0       ?        
heres the code again:
#include <stdio.h>
#include <stdlib.h>

int main()
{
 FILE * opfile, * readfile;
 double var[5][5], varr[5][5];
 int i,j,k;

 for(i = 0; i < 5; i++)
 for(j = 0; j < 5; j++)
 var[i][j] = i+j+1;

 opfile = fopen("storefile", "w");
 if(opfile == NULL){
 printf("You suck\n");
 return 0;
 }
 fwrite(var, sizeof(double), 25, opfile);

 fclose(opfile);
 readfile = fopen("storefile", "r");

 fread(varr, sizeof(double), 25, opfile);
 for(i = 0; i < 5; i++){
 for(j = 0; j < 5; j ++)
 printf("%f %f\n", varr[i][j], var[i][j]);
 }

 return 0;
}

Read Full Discussion Thread for this article