Okay Quzah:
I replaced 'fprintf' with 'stdout' and the compiler complained about something later in that same line of code not being a 'function'.
Code:
#include <stdio.h>
int main()
{
float hourly_rate;
int total_income;
int hours_per_week;
float num_weeks;
FILE * input_file;
FILE * output_file;
input_file = fopen("JOB.DAT", "r");
output_file = fopen("INCOME.OUT", "w");
fscanf(input_file, "%f", &hourly_rate);
fscanf(input_file, "%d", &hours_per_week);
fscanf(input_file, "%f", &num_weeks);
total_income = hourly_rate * hours_per_week * num_weeks;
stdout(output_file, "You will make $ %.2f in %d weeks this summer\n",
total_income, num_weeks);
fclose(input_file);
fclose(output_file);
system("PAUSE");
return 0;
}
--------Then I put stdout in place of 'output_file' and got------
Code:
#include <stdio.h>
int main()
{
float hourly_rate;
int total_income;
int hours_per_week;
float num_weeks;
FILE * input_file;
FILE * output_file;
input_file = fopen("JOB.DAT", "r");
output_file = fopen("INCOME.OUT", "w");
fscanf(input_file, "%f", &hourly_rate);
fscanf(input_file, "%d", &hours_per_week);
fscanf(input_file, "%f", &num_weeks);
total_income = hourly_rate * hours_per_week * num_weeks;
fprintf(stdout,"You will make $ %.2f in %d weeks this summer\n",
total_income, num_weeks);
fclose(input_file);
fclose(output_file);
system("PAUSE");
return 0;
}
The first threw me a compiler error "called object is not a function".
The second time when I put stdout in the parenthesis the console does display the statement the only thing is it is filled with bogus numbers. I thought (obviously incorrectly) that the pointer had to stay in the statement but when I left it in the compiler whined again. Could you help by giving me a correct rendition of this little proggy? Maybe then I`ll be able to figure out what I`m supposed to do. I`ve been reading the last 3 hours in an attempt to find the right way to print a file result to the screen to no avail.