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.17
17 (_XOPEN_SOURCE >= 500 && ! (_POSIX_C_SOURCE >= 200809L))
18 || /* Glibc >= 2.20 */ _DEFAULT_SOURCE
19 || /* Glibc <= 2.19 */ _SVID_SOURCE
20 Glibc versions 2.12 to 2.16:
21 (_XOPEN_SOURCE >= 500 && ! (_POSIX_C_SOURCE >= 200112L))
22 || _SVID_SOURCE
23 Before glibc 2.12:
24 _SVID_SOURCE || _XOPEN_SOURCE >= 500
25
27 The gcvt() function converts number to a minimal length null-terminated
28 ASCII string and stores the result in buf. It produces ndigit signifi‐
29 cant digits in either printf(3) F format or E format.
30
32 The gcvt() function returns buf.
33
35 For an explanation of the terms used in this section, see at‐
36 tributes(7).
37
38 ┌────────────────────────────────────────────┬───────────────┬─────────┐
39 │Interface │ Attribute │ Value │
40 ├────────────────────────────────────────────┼───────────────┼─────────┤
41 │gcvt() │ Thread safety │ MT-Safe │
42 └────────────────────────────────────────────┴───────────────┴─────────┘
43
45 Marked as LEGACY in POSIX.1-2001. POSIX.1-2008 removes the specifica‐
46 tion of gcvt(), recommending the use of sprintf(3) instead (though
47 snprintf(3) may be preferable).
48
50 ecvt(3), fcvt(3), sprintf(3)
51
53 This page is part of release 5.12 of the Linux man-pages project. A
54 description of the project, information about reporting bugs, and the
55 latest version of this page, can be found at
56 https://www.kernel.org/doc/man-pages/.
57
58
59
60 2021-03-22 GCVT(3)