/* some file I/O (Input/Output) */ #include int main() { float a, b; int c, d; FILE *infile; FILE *outfile; /* open the files */ infile = fopen("04_input_data.txt", "r"); outfile = fopen("06_output_data.txt", "w"); /* scan in the data */ fscanf(infile, "%f", &a); fscanf(infile, "%f", &b); fscanf(infile, "%d", &c); fscanf(infile, "%d", &d); /* let the user know how it's going */ printf("We got a = %f b = %f c = %d d = %d from the input file\n", a, b, c, d); /* write the data */ fprintf(outfile, "%f %f %d %d\n", a, b, c, d); /* remember to close the file */ fclose(infile); fclose(outfile); }