---
name: "ecvt_r"
section: "3"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ecvt_r"
---

# ecvt\_r(3)

convert a floating-point number to a string

## NAME

ecvt\_r, fcvt\_r, qecvt\_r, qfcvt\_r - convert a floating-point number to a string

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

```
#include <stdlib.h>
```

**\[\[deprecated\]\] int ecvt\_r(double** *number***, int** *ndigits***,**                           **int \*restrict** *decpt***, int \*restrict** *sign***,**                           **char \*restrict** *buf***, size\_t** *size***);** **\[\[deprecated\]\] int fcvt\_r(double** *number***, int** *ndigits***,**                           **int \*restrict** *decpt***, int \*restrict** *sign***,**                           **char \*restrict** *buf***, size\_t** *size***);**

**\[\[deprecated\]\] int qecvt\_r(long double** *number***, int** *ndigits***,**                           **int \*restrict** *decpt***, int \*restrict** *sign***,**                           **char \*restrict** *buf***, size\_t** *size***);** **\[\[deprecated\]\] int qfcvt\_r(long double** *number***, int** *ndigits***,**                           **int \*restrict** *decpt***, int \*restrict** *sign***,**                           **char \*restrict** *buf***, size\_t** *size***);**

Feature Test Macro Requirements for glibc (see [**feature\_test\_macros**(7)](/feature_test_macros/7.md)):

**ecvt\_r**(), **fcvt\_r**(), **qecvt\_r**(), **qfcvt\_r**():

```
    /* glibc >= 2.19: */ _DEFAULT_SOURCE
        || /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE
```

## DESCRIPTION

The functions **ecvt\_r**(), **fcvt\_r**(), **qecvt\_r**(), and **qfcvt\_r**() are identical to [**ecvt**(3)](/ecvt/3.md), [**fcvt**(3)](/fcvt/3.md), [**qecvt**(3)](/qecvt/3.md), and [**qfcvt**(3)](/qfcvt/3.md), respectively, except that they do not return their result in a static buffer, but instead use the supplied *buf* of size *size*. See [**ecvt**(3)](/ecvt/3.md) and [**qecvt**(3)](/qecvt/3.md).

## RETURN VALUE

These functions return 0 on success, and -1 otherwise.

## ATTRIBUTES

For an explanation of the terms used in this section, see [**attributes**(7)](/attributes/7.md).

| | | |
| --- | --- | --- |
| **Interface** | **Attribute** | **Value** |
| **ecvt\_r**(), **fcvt\_r**(), **qecvt\_r**(), **qfcvt\_r**() | Thread safety | MT-Safe |

## STANDARDS

GNU.

## NOTES

These functions are obsolete. Instead, [**sprintf**(3)](/sprintf/3.md) is recommended.

## SEE ALSO

[**ecvt**(3)](/ecvt/3.md), [**qecvt**(3)](/qecvt/3.md), [**sprintf**(3)](/sprintf/3.md)
