B
Bill Cunningham
I'm doing something wrong and all I know to do is turn to clc. I have a
text file containing 2 doubles separated by a tab.
..26 0
Is the text. I want to read the two double and printf them out. Here's my
file.
#include <stdio.h>
int main() {
FILE *fp;
double x,y;
fp=fopen("zo","r"); /*error checking out for brevity */
fscanf(fp,"%.2f\t%.2f",&string);
fclose(fp);
printf("%.2f%.2f",x,y);
}
All I get is garbage that is contained in x and y. For whatever simple
reason that is beyond me evidently I can't read and printf out to stdin from
this text file. I don't think fread is really necessary.
Bill
text file containing 2 doubles separated by a tab.
..26 0
Is the text. I want to read the two double and printf them out. Here's my
file.
#include <stdio.h>
int main() {
FILE *fp;
double x,y;
fp=fopen("zo","r"); /*error checking out for brevity */
fscanf(fp,"%.2f\t%.2f",&string);
fclose(fp);
printf("%.2f%.2f",x,y);
}
All I get is garbage that is contained in x and y. For whatever simple
reason that is beyond me evidently I can't read and printf out to stdin from
this text file. I don't think fread is really necessary.
Bill