#define LIMIT 10000
FILE *infile;
FILE *outfile;
double prices[LIMIT];
char answer[10];
int i = 0;
infile = fopen("ibm_stock_prices", "r");
outfile = fopen("buy_hold_or_sell", "w");
if (fp != NULL && output_file != NULL) {
/* Read the input data */
while ((fscanf(infile, "%lf", prices[i]) != EOF) && i < LIMIT)
i++;
printf("%d prices read from the data file", i);
/* Process the data... */
:
:
/* Write the output */
fprintf(output_file, "%s", answer);
}
else {
printf("fopen unsuccessful!\n");
}