DTOSTR_BUF_SIZE


Description:

[ CCode ( cname = "G_ASCII_DTOSTR_BUF_SIZE" ) ]
public const int DTOSTR_BUF_SIZE

A good size for a buffer to be passed into to_str.

It is guaranteed to be enough for all output of that function on systems with 64bit IEEE-compatible doubles.

The typical usage would be something like:

	char buf[G_ASCII_DTOSTR_BUF_SIZE];

fprintf (out, "value=%s\n", g_ascii_dtostr (buf, sizeof (buf), value));

Example: Convert a double to a string (Buffer):

public static int main (string[] args) {
// Output: ``20``
char[] buf = new char[double.DTOSTR_BUF_SIZE];
unowned string str = (20.0).to_str (buf);
print ("%s\n", str);
return 0;
}

valac --pkg glib-2.0 double.DTOSTR_BUF_SIZE.vala



2022 vala-language.org