#include
#include
int main()
{
char s[100] =\"4.0800\" ;
printf(\"float value : %4.8f\\n\" ,(float) atoll(s));
return
Use atof()
But this is deprecated, use this instead:
const char* flt = "4.0800";
float f;
sscanf(flt, "%f", &f);
http://www.cplusplus.com/reference/clibrary/cstdlib/atof/
atof()
returns 0
for both failure and on conversion of 0.0
, best to not use it.
You want to use the atof() function.
http://www.cplusplus.com/reference/clibrary/cstdlib/atof/