I need help!
I working on an assignment for class and trying to run this source code!
I keep getting this error ***processed returned 255*** after code crashes.
Here is my source code. I am rather new at Pelles C.
#include <stdio.h>
#define KMS_PER_MILE 1.609
int
main (void)
{
double miles,kms;
FILE *inp, *outp;
inp = fopen ("b:distance .txt", "r");
outp= fopen ("b:distout.txt", "w");
fscanf (inp, "%lf", &miles);
fprintf (outp, "The distance in miles is %.2f. \n", miles);
kms = KMS_PER_MILE * miles;
fprintf(outp,"that equals %.2f kilometers.\n",kms);
fclose (inp);
fclose (outp);
return(0);
}
Have you seen the blank in your filename?
Use:
"b:\\distance.txt"
You should check if fopen succeded:
inp = fopen ("b:\\distance.txt", "r");
if (inp) {
// do what you want
} else puts("error opening file!");
Thanks for replying with help. I did what you said and got the error message could not open file. Could there be some thing wrong with my file name!
Have you really that B-drive ?
You can test opening that file from current directory to test rest of that codeinp = fopen ("distance.txt", "r");
I tried that and still got the same thing! I wander does it make a difference if I am using Windows 7.