I know where my problem is, but I don't know how to fix it, or why it's happening this way. I am reading input from a file that for some reason reads in everything as strings. So I have to change those strings into numbers. These numbers may, but won't necesarily, be decimals with no more than 15 decimal places. I'm having trouble knowing what to store these numbers as. Float, Long, Double, what's the deal? Here are the important bits of my code:
Should it be "float yLC = atof(yllc);"?
Is there something else I shold use instead of atof()?
I also don't know what to print it as.
Yup, I'm pretty clueless.
don't panic, I'm mostly harmless
Sarah
Code:
char *xllc = malloc(20 * sizeof(char));
char *yllc = malloc(20 * sizeof(char));
fscanf(aFile, "%s\n%s\n", xllc, yllc);
//here's where the trouble is
long yLC = atof(yllc);
long xLC = atof(xllc);
Is there something else I shold use instead of atof()?
I also don't know what to print it as.
Yup, I'm pretty clueless.
don't panic, I'm mostly harmless
Sarah