I thought if atof was used on a string containing spaces it would not work. I have inserted spaces before the string and after. The atof still converts the string to a double. Is that everyone elses understanding as well? Using the code below I always get 23.345 when using all 3 strcpy's below. Confused.....
Code:
strcpy(hardness, "23.345 ");
strcpy(hardness, " 23.345");
strcpy(hardness, "23.345");
Code:
char hardness[256];
double hardness2 =0;
strcpy(hardness, "23.345 ");
hardness2 = atof(hardness);
printf("%1f\n", hardness2);