Hi to all,
I need to convert strings in exponential format and I have noticed that the val () function it is not able to perform this conversion. I have tried with the function _atof () of the crtdll.lib (see the example below) and everything seems to work fine but I am not sure if I am doing something of wrong.
declare cdecl extern _atof(mystr as string),double
string test
double number
test = "4.94171e+006"
number = _atof(test)
print number
print val(test)
do : until inkey$ <> ""
end
Can anyone help me?
Thanks!
Sergio
You need to use SETPRECISION to change the precision that PRINT prints.
Parker, many thanks for your reply. I know SETPRECISION, but what I would to know if to use the function atof as I have done, can create problems in my programs (for example, the atof declaration is correct?)
Thanks!
Sergio
Looks correct to me ;)
Paul, thank you for your reply.
Can you suggest to me where to find the contents and the declarations of the crtdll lib?? (I've browsed the MSDN site with poor results)
Thanks
Sergio
http://msdn2.microsoft.com/en-us/library/634ca0c2(VS.80).aspx
Some functions may or may not have an extra underscore prepended to them. If you get an error from the linker that is the first place to look. Microsoft likes to deviate from the C standard, sometimes between different VC library versions ;)
Of course just searching Google, for a specific funciton name like sprintf, will bring up hundreds of references. Here's one that is used by Linux programmers, the C library is cross platform so the functions work the same:
http://www.phim.unibe.ch/comp_doc/c_manual/C/FUNCTIONS/funcref.htm#headers
Paul.
Thanks! :D
Bye
Sergio