dwww Home | Manual pages | Find package

strfromd(3)                Library Functions Manual                strfromd(3)

NOM
       strfromd,  strfromf,  strfroml - Convertir des nombres en virgule flot-
       tante en chaînes de caractères

BIBLIOTHÈQUE
       Bibliothèque C standard (libc, -lc)

SYNOPSIS
       #include <stdlib.h>

       int strfromd(char str[restrict .n], size_t n,
                    const char *restrict format, double fp);
       int strfromf(char str[restrict .n], size_t n,
                    const char *restrict format, float fp);
       int strfroml(char str[restrict .n], size_t n,
                    const char *restrict format, long double fp);

   Exigences de macros de test de fonctionnalités  pour  la  glibc  (consulter
   feature_test_macros(7)) :

       strfromd(), strfromf(), strfroml() :
           __STDC_WANT_IEC_60559_BFP_EXT__

DESCRIPTION
       Ces fonctions convertissent une valeur en virgule flottante, fp, en une
       chaîne de caractères, str, selon une  chaîne  configurable  format.  Au
       plus n caractères sont écrits dans str.

       The  terminating null byte ('\0') is written if and only if n is suffi-
       ciently large, otherwise the written string is truncated at  n  charac-
       ters.

       Les  fonctions  strfromd(),  strfromf() et strfroml() sont équivalentes
       à :

           snprintf(str, n, format, fp);

       excepté pour la chaîne format.

   CHAÎNE DE FORMAT
       The format string must start with the character '%'. This  is  followed
       by  an  optional  precision which starts with the period character (.),
       followed by an optional decimal integer. If no integer is specified af-
       ter  the  period  character,  a precision of zero is used. Finally, the
       format string should have one of the conversion specifiers a, A, e,  E,
       f, F, g, or G.

       L'indicateur  de  conversion  est  appliqué en se basant sur le type de
       virgule flottante indiqué par le suffixe de la fonction. Ainsi, et à la
       différence de snprintf(), la chaîne de formatage ne contient pas de ca-
       ractère de modification de longueur.  Consultez  snprintf(3)  pour  une
       description détaillée de ces indicateurs de conversion.

       L'implémentation  est  conforme à la norme C99 concernant la conversion
       de NaN et de valeurs infinies :

              Si fp est NaN, +NaN ou -NaN et f (ou a, e, g)  est  l'indicateur
              de  conversion,  la  conversion se fait vers « nan », « nan » ou
              « -nan » respectivement. Si F (ou A, E, G) est  l'indicateur  de
              conversion,  la  conversion  est  alors  faite  vers  « NAN » ou
              « -NAN ».

              De même si fp est infini, il est converti en [-]inf ou [-]INF.

       Une chaîne format malformée entraîne un comportement non défini.

VALEUR RENVOYÉE
       The strfromd(), strfromf(), and strfroml()  functions return the number
       of  characters  that  would  have  been  written in str if n had enough
       space, not counting the terminating null byte. Thus, a return value  of
       n or greater means that the output was truncated.

VERSIONS
       The  strfromd(),  strfromf(),  and  strfroml()  functions are available
       since glibc 2.25.

ATTRIBUTS
       Pour une explication des termes utilisés dans cette section,  consultez
       attributes(7)  et la section POSIX Safety Concepts dans le manuel de la
       Bibliothèque C GNU.

       ┌──────────────────────────────┬──────────────────────┬────────────────┐
       │InterfaceAttributValeur         │
       ├──────────────────────────────┼──────────────────────┼────────────────┤
       │                              │ Sécurité des threads │ MT-Safe locale │
       │strfromd(), strfromf(),       ├──────────────────────┼────────────────┤
       │strfroml()                    │ Async-signal safety  │ AS-Unsafe heap │
       │                              ├──────────────────────┼────────────────┤
       │                              │ Async-cancel safety  │ AC-Unsafe mem  │
       └──────────────────────────────┴──────────────────────┴────────────────┘
       Note : ces attributs sont préliminaires

STANDARDS
       C99, ISO/IEC TS 18661-1.

NOTES
       Les  fonctions  strfromd(), strfromf() et strfroml() prennent en compte
       la catégorie LC_NUMERIC de la locale utilisée.

EXEMPLES
       Pour convertir la valeur 12.1 en tant que type flottant en  une  chaîne
       utilisant la notation décimale, résultant en « 12.100000 » :

           #define __STDC_WANT_IEC_60559_BFP_EXT__
           #include <stdlib.h>
           int ssize = 10;
           char s[ssize];
           strfromf(s, ssize, "%f", 12.1);

       Pour  convertir  la  valeur  12.3456  en  tant que type flottant en une
       chaîne utilisant la  notation  décimale  avec  une  précision  de  deux
       chiffres après la virgule, résultant en « 12.35 » :

           #define __STDC_WANT_IEC_60559_BFP_EXT__
           #include <stdlib.h>
           int ssize = 10;
           char s[ssize];
           strfromf(s, ssize, "%.2f", 12.3456);

       Pour  convertir  la  valeur  12.345e19  en  tant que type double en une
       chaîne utilisant la notation scientifique avec aucun chiffre  après  la
       virgule, résultant en « 1E+20 » :

           #define __STDC_WANT_IEC_60559_BFP_EXT__
           #include <stdlib.h>
           int ssize = 10;
           char s[ssize];
           strfromd(s, ssize, "%.E", 12.345e19);

VOIR AUSSI
       atof(3), snprintf(3), strtod(3)

TRADUCTION
       La  traduction française de cette page de manuel a été créée par Chris-
       tophe Blaess <https://www.blaess.fr/christophe/>, Stéphan  Rafin  <ste-
       phan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, Fran-
       çois Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe  Gué-
       rard  <fevrier@tigreraye.org>,  Jean-Luc  Coulon (f5ibh) <jean-luc.cou-
       lon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>,  Thomas  Huriaux
       <thomas.huriaux@gmail.com>,  Nicolas François <nicolas.francois@centra-
       liens.net>, Florentin Duneau <fduneau@gmail.com>, Simon  Paillard  <si-
       mon.paillard@resel.enst-bretagne.fr>,    Denis   Barbier   <barbier@de-
       bian.org>, David Prévot <david@tilapin.org>  et  Grégoire  Scano  <gre-
       goire.scano@malloc.fr>

       Cette traduction est une documentation libre ; veuillez vous reporter à
       la       GNU       General       Public        License        version 3
       ⟨https://www.gnu.org/licenses/gpl-3.0.html⟩  concernant  les conditions
       de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE.

       Si vous découvrez un bogue dans la traduction de cette page de  manuel,
       veuillez envoyer un message à ⟨debian-l10n-french@lists.debian.org⟩.

Pages du manuel de Linux 6.03   5 février 2023                     strfromd(3)

Generated by dwww version 1.15 on Sat Jun 29 01:43:57 CEST 2024.