1GCVT(3) Linux Programmer's Manual GCVT(3)
2
3
4
6 gcvt - convert a floating-point number to a string
7
9 #include <stdlib.h>
10
11 char *gcvt(double number, int ndigit, char *buf);
12
13 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15 gcvt():
16 Since glibc 2.12:
17 (_XOPEN_SOURCE >= 500) ! (_POSIX_C_SOURCE >= 200112L)
18 || /* Glibc since 2.19: */ _DEFAULT_SOURCE
19 || /* Glibc versions <= 2.19: */ _SVID_SOURCE
20 Before glibc 2.12:
21 _SVID_SOURCE || _XOPEN_SOURCE >= 500
22
24 The gcvt() function converts number to a minimal length null-terminated
25 ASCII string and stores the result in buf. It produces ndigit signifi‐
26 cant digits in either printf(3) F format or E format.
27
29 The gcvt() function returns buf.
30
32 For an explanation of the terms used in this section, see at‐
33 tributes(7).
34
35 ┌──────────┬───────────────┬─────────┐
36 │Interface │ Attribute │ Value │
37 ├──────────┼───────────────┼─────────┤
38 │gcvt() │ Thread safety │ MT-Safe │
39 └──────────┴───────────────┴─────────┘
40
42 Marked as LEGACY in POSIX.1-2001. POSIX.1-2008 removes the specifica‐
43 tion of gcvt(), recommending the use of sprintf(3) instead (though
44 snprintf(3) may be preferable).
45
47 ecvt(3), fcvt(3), sprintf(3)
48
50 This page is part of release 5.10 of the Linux man-pages project. A
51 description of the project, information about reporting bugs, and the
52 latest version of this page, can be found at
53 https://www.kernel.org/doc/man-pages/.
54
55
56
57 2017-09-15 GCVT(3)