08-04-2024, 05:15 PM
Code: (Select All)
Declare Library
Function snprintf& (Dest As String, Byval l As Long, frmt As String, Byval x As _Float)
End Declare
Dim As String * 20 result
Dim As String format
Dim As Long resultlen, flag
Dim As Single x
resultlen = Len(result) - 1
result = Space$(resultlen) + Chr$(0)
format = "%.2e" + Chr$(0)
x = 12345.6
flag = snprintf&(result, resultlen, format, x)
Print result
result = Space$(resultlen) + Chr$(0)
format = "%12.2e" + Chr$(0)
x = 12345.6
flag = snprintf&(result, resultlen, format, x)
Print result