Looking for _gcvt(double,int,string)
I found this neat little GUI calculator program on the net.
It uses a function called _gcvt(double val,int limit,string cBuf), which seems to be used to convert a double val to a string cBuf, with some formatting and limiting.
I replaced it with sprintf(), but the output looks rather crude to the perfectionist.
xfind.exe can find _gcvt in a few header files, but Dev C++ does not respond to it. Does anybody have some past experience with it?
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
_gcvt is a Visual Studio function. sprintf should work fine provided you consider limit as the number of significant precision digits.
>but the output looks rather crude to the perfectionist.
How appropriately vague. Care to be more specific?
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
Thanks for the answer!
I will use sprintf(), but need to adjust the precision digits to something sensible.
2.3 + 3.4 = 5.700000000 looks silly!
I had the notion that _gcvt might do this.
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
>2.3 + 3.4 = 5.700000000 looks silly!
You can specify a precision with sprintf:
sprintf ( cBuf, "%.*f", limit, val );
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>2.3 + 3.4 = 5.700000000 looks silly!
You can specify a precision with sprintf:
sprintf ( cBuf, "%.*f", limit, val );
I forgot about that, thanks Narue!
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417