FloatToString method


Prototype

FloatToString Proto fValue:Real8, lpszBuffer:LPSTR

Syntax

Invoke FloatToString, fValue, lpszBuffer

Function

Converts a double-precision value to a null-terminated string.

Parameters

fValue

Double-precision value to be converted (Please see the WARNING at the end of the page).

lpszBuffer

Pointer to a buffer to receive the converted value.

Return value

Eax/Rax returns the number of characters placed in the buffer excluding the terminating null character.


REMARKS: The FloatToString method will fill the buffer pointed by lpszBuffer with a Unicode string if the application is running as Unicode, or with an ANSI string if not (see the IsAppUnicode method). You can call FloatToStringA to get ANSI strings in Unicode applications, or FloatToStringW to get Unicode strings in ANSI applications.

WARNING: When working with FASM, GOASM or SOLASM 32-bit projects, the fValue parameter (which is a QWORD) must be split in two DWORD values in the following way (fTest would be a QWORD variable with a double-precision value):

FASM:       stdcall FloatToString, DWORD [fTest], DWORD [fTest + 4], [lpszBuffer]
GOASM:    Invoke FloatToString, [fTest], [fTest + 4], [lpszBuffer]
SOLASM:  invoke FloatToString, ecx, edx, [lpszBuffer]   ;Registers ecx and edx must be loaded before the call (mov ecx, dword [fTest] and mov edx, dword [fTest+4])


Also see the StringToFloat method.