Quote Originally Posted by Protocol View Post
...
Code:
struct SizeAll{ 
		int year; 
		double R; 
		}; 



int write_to_file(int count, struct SizeAll *data, char const *fileName) 
{ 
  FILE *f = fopen(fileName, "w"); 
  if (f == NULL) return -1; 
  while (count-- > 0) { 
    // you might want to check for out-of-disk-space here, too 
    fprintf(f, "%d,%d", data->year, data->R); 
    ++data; 
  } 
  fclose(f); 
  return 0; 
}
Why do you format the double R as integer? Does it make any real sense in your case?