i'm following a textbook to learn C, and the following example was used to show how to Program-Controlled Input and Output files...
Code:
#include <stdio.h>
#define KMS_PER_MILE 1.609
int
main(void)
{
double miles, kms;
/* set pointers */
FILE *inp, *outp;
/* open input/output files */
inp = fopen("b:input_file.txt", "r");
outp = fopen("b:output_file.txt", "w");
/* get and echo info */
fscanf(inp, "%1f", miles);
fprintf(outp, "The distance in miles is %.2f.\n", miles);
/* convert distance to kms */
kms = KMS_PER_MILE * miles;
/* display distance in kms */
fprintf(outp, "That equals %.2f kilometers.\n", kms);
/* close files */
fclose(inp);
fclose(outp);
return(0);
}
the trouble is, I run it and it doesn't work.
I have tried searching for "b:" as it was used here:
Code:
/* open input/output files */
inp = fopen("b:input_file.txt", "r");
outp = fopen("b:output_file.txt", "w");
in google to find out what it does, but I have found nothing.
What the heck?