cansi-catof

atof() for float instead of double


atof() returns a double, which results in a warning when I assign it to a float-value (and yes, I definitively have to use float).

So my question: is there a atof()-variant available which returns a plain float? Or do I have to solve this by a cast - which would be a pity because it wastes resources for creating a double which will be thrown away immediately.


Solution

  • Use strtof instead, it will return a float.

    See documentation here