Function

GLibascii_dtostr

Declaration

gchar*
g_ascii_dtostr (
  gchar* buffer,
  gint buf_len,
  gdouble d
)

Description

Converts a gdouble to a string, using the ‘.’ as decimal point.

This function generates enough precision that converting the string back using g_ascii_strtod() gives the same machine-number (on machines with IEEE compatible 64bit doubles). It is guaranteed that the size of the resulting string will never be larger than G_ASCII_DTOSTR_BUF_SIZE bytes, including the terminating nul character, which is always added.

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.

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.