GLib.ascii_formatd (original) (raw)
Function
GLibascii_formatd
Declaration [src]
gchar*
g_ascii_formatd (
gchar* buffer,
gint buf_len,
const gchar* format,
gdouble d
)
Description [src]
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 g_ascii_dtostr().
Parameters
buffer
Type: gchar*
A buffer to place the resulting string in.
The data is owned by the caller of the function. |
---|
The value is a NUL terminated UTF-8 string. |
buf_len
Type: gint
The length of the buffer.
format
Type: const gchar*
The printf()
-style format to use for the code to use for converting.
The data is owned by the caller of the function. |
---|
The value is a NUL terminated UTF-8 string. |
d
Type: gdouble
The value to convert.
Return value
Type: gchar*
The pointer to the buffer with the converted string.
The caller of the function takes ownership of the data, and is responsible for freeing it. |
---|
The value is a NUL terminated UTF-8 string. |