format


Description:

[ CCode ( cname = "g_ascii_formatd" , instance_pos = -1 ) ]
public unowned string format (char[] buffer, string format = "%g")

Converts a `gdouble` to a string, using the '.

' as decimal point. To format the number you pass in a `printf()`-style format string. Allowed conversion specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'.

The format must just be a single format specifier starting with `%`, expecting a `gdouble` argument.

The returned buffer is guaranteed to be nul-terminated.

If you just want to want to serialize the value into a string, use [func@GLib.ascii_dtostr].

Parameters:

buffer

a buffer to place the resulting string in

format

the `printf()`-style format to use for the code to use for converting

buf_len

the length of the buffer

d

the value to convert

Returns:

the pointer to the buffer with the converted string