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 the address of the string pointed to by
30 buf.
31
33 For an explanation of the terms used in this section, see
34 attributes(7).
35
36 ┌──────────┬───────────────┬─────────┐
37 │Interface │ Attribute │ Value │
38 ├──────────┼───────────────┼─────────┤
39 │gcvt() │ Thread safety │ MT-Safe │
40 └──────────┴───────────────┴─────────┘
41
43 Marked as LEGACY in POSIX.1-2001. POSIX.1-2008 removes the specifica‐
44 tion of gcvt(), recommending the use of sprintf(3) instead (though
45 snprintf(3) may be preferable).
46
48 ecvt(3), fcvt(3), sprintf(3)
49
51 This page is part of release 5.02 of the Linux man-pages project. A
52 description of the project, information about reporting bugs, and the
53 latest version of this page, can be found at
54 https://www.kernel.org/doc/man-pages/.
55
56
57
58 2017-09-15 GCVT(3)