The printf below prints
SPY 06/18/09 -2.690002 -2.690002
SPY 07/09/09 2.089996 -0.600006
SPY 09/03/09 0.849998 0.249992
But the fprintf prints just gibberish that it can't be reproduced here. It deletes itself.
SPY 06/18/09 -2.690002 -2.690002
SPY 07/09/09 2.089996 -0.600006
SPY 09/03/09 0.849998 0.249992
But the fprintf prints just gibberish that it can't be reproduced here. It deletes itself.
Code:
char **totalreturn;
totalreturn = (char **) calloc(100,sizeof(char*));
for (i = 0; i< 60; i++)
totalreturn[i] = (char *) calloc(10,sizeof(char));
struct {
char date[12];
float tr;
int up;
int cnt;
float vol;
float ma;
// float oldprice;
} *result;
result = calloc(1000, sizeof(result));
FILE *output;
output = fopen("/ABC.txt", "w");
printf("%s %s %f %f\n",totalreturn[l], result[i].date, net, gain);
fprintf(output,"%s, %s, %f, %f\n", totalreturn[l], result[i].date, net, gain);