title: Print Numbers to File in C?
body: <p>I'm a beginner to C but not too bad at programming all around. I'm writing a program in C that calculates the path of an object (x, y, and z coordinates) according to few equations which depend on time. I then want to print these coordinates to an output file so I can plot them. Right now, I have:</p>
  
  <pre><code>double *t;
  double *x;
  double *y;
  double *z;
  </code></pre>
  
  <p>I do my calculations and fill up x, y, and z. I then try to print them to a file:</p>
  
  <pre><code>FILE *outputFile = fopen("path.out", "w");
  
  for (i = 0; i&lt;(sizeof(x)/sizeof(double)); ++i)
      char *strX = (char *) *(x+i);
      char *strY = (char *) *(y+i);
      char *strZ = (char *) *(z+i);
      fprintf(*outputFile, *strX);
      fprintf(*outputFile, "\t");
      fprintf(*outputFile, *strY);
      fprintf(*outputFile, "\t");
      fprintf(*outputFile, *strZ);
  </code></pre>
  
  <p>I'm getting a whole mess of errors trying to cast each double to a char *, but I'm not sure why. Is there a better way to print the doubles or to cast them to a char * for printing?</p>