Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Mar 2004 23:40:11 +0930
From:      Malcolm Kay <malcolm.kay@internode.on.net>
To:        Eric De la Cruz Lugo <eric@iteso.mx>, freebsd-questions@freebsd.org
Subject:   Re: Problem compiling code in freeBSD 4,9 strtof related.
Message-ID:  <200403282340.11447.malcolm.kay@internode.on.net>
In-Reply-To: <1080367170.4065184245b82@iteso.mx>
References:  <1080367170.4065184245b82@iteso.mx>

next in thread | previous in thread | raw e-mail | index | archive | help
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,=20
but this is not a likely problem if the author has chosen to use float=20
rather than double. In most cases the cast (float) can be omitted.

I suggest you edit the application source to use strtod.

Malcolm



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403282340.11447.malcolm.kay>