Problem compiling code in freeBSD 4,9 strtof related.
malcolm.kay at internode.on.net
Sun Mar 28 06:10:19 PST 2004
On Saturday 27 March 2004 16:29, Eric De la Cruz Lugo wrote:
> Hi, I am trying to compile the BhPos software (Point of Sale for Linux.
> But I need the strtof function , but FreeBSD 4,9 does not have this
> function, it is possible to install it taking the source code from the 5.X
> FreeBSD branch?
C standard C89 had strtod but not strtof.
Strtof appears in the C99 standard.
The strtod returns a double type while strtof returns a float.
For most practical purposes you can substitute (float)strtod(...)
for strtof(...). There might be a difference in what happens on errors,
particularly if the converted result won't fit in a float variable,
but this is not a likely problem if the author has chosen to use float
rather than double. In most cases the cast (float) can be omitted.
I suggest you edit the application source to use strtod.
More information about the freebsd-questions