.\" -*- coding: UTF-8 -*- .\" Copyright (c) 2016, IBM Corporation. .\" Written by Wainer dos Santos Moschetta .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of .\" this manual under the conditions for verbatim copying, provided that .\" the entire resulting derived work is distributed under the terms of .\" a permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume. .\" no responsibility for errors or omissions, or for damages resulting. .\" from the use of the information contained herein. The author(s) may. .\" not have taken the same level of care in the production of this. .\" manual, which is licensed free of charge, as they might when working. .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" References consulted: .\" Glibc 2.25 source code and manual. .\" C99 standard document. .\" ISO/IEC TS 18661-1 technical specification. .\" snprintf and other man.3 pages. .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH STRFROMD 3 "6 mars 2019" GNU "Manuel du programmeur Linux" .SH NOM strfromd, strfromf, strfroml \- Convertir des nombres en virgule flottante en chaînes de caractères .SH SYNOPSIS .nf \fB#include \fP .PP \fBint strfromd(char *restrict \fP\fIstr\fP\fB, size_t \fP\fIn\fP\fB,\fP \fB const char *restrict \fP\fIformat\fP\fB, double \fP\fIfp\fP\fB);\fP \fBint strfromf(char *restrict \fP\fIstr\fP\fB, size_t \fP\fIn\fP\fB,\fP \fB const char *restrict \fP\fIformat\fP\fB, float \fP\fIfp\fP\fB);\fP \fBint strfroml(char *restrict \fP\fIstr\fP\fB, size_t \fP\fIn\fP\fB,\fP \fB const char *restrict \fP\fIformat\fP\fB, long double \fP\fIfp\fP\fB);\fP .fi .PP .RS -4 Exigences de macros de test de fonctionnalités pour la glibc (consulter \fBfeature_test_macros\fP(7))\ : .RE .PP .ad l \fBstrfromd\fP(), \fBstrfromf\fP(), \fBstrfroml\fP()\ : .RS 4 __STDC_WANT_IEC_60559_BFP_EXT__ .RE .ad b .SH DESCRIPTION Ces fonctions convertissent une valeur en virgule flottante, \fIfp\fP, en une chaîne de caractères, \fIstr\fP, selon une chaîne configurable \fIformat\fP. Au plus \fIn\fP caractères sont écrits dans \fIstr\fP. .PP The terminating null byte ('\e0') is written if and only if \fIn\fP is sufficiently large, otherwise the written string is truncated at \fIn\fP characters. .PP Les fonctions \fBstrfromd\fP(), \fBstrfromf\fP() et \fBstrfroml\fP() sont équivalentes à\ : .PP .in +4n .EX snprintf(str, n, format, fp); .EE .in .PP excepté pour la chaîne \fIformat\fP. .SS "Format de la chaîne de formatage" La chaîne \fIformat\fP doit débuter par le caractère «\ %\ ». Il est suivi d'une précision optionnelle qui commence au caractère point (.), suivie d'un entier optionnel en base décimale. Si aucun entier n'est donné après le caractère point, une précision de zéro est utilisée. Enfin, la chaîne de formatage doit contenir un des indicateurs de conversion \fBa\fP, \fBA\fP, \fBe\fP, \fBE\fP, \fBf\fP, \fBF\fP, \fBg\fP ou \fBG\fP. .PP 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 \fBsnprintf\fP(), la chaîne de formatage ne contient pas de caractère de modification de longueur. Consultez \fBsnprintf\fP(3) pour une description détaillée de ces indicateurs de conversion. .PP L'implémentation est conforme à la norme C99 concernant la conversion de NaN et de valeurs infinies\ : .PP .RS Si \fIfp\fP est \fINaN\fP, \fI+NaN\fP ou \fI\-NaN\fP et \fBf\fP (ou \fBa\fP, \fBe\fP, \fBg\fP) est l'indicateur de conversion, la conversion se fait vers «\ nan\ », «\ nan\ » ou «\ \-nan\ » respectivement. Si \fBF\fP (ou \fBA\fP, \fBE\fP, \fBG\fP) est l'indicateur de conversion, la conversion est alors faite vers «\ NAN\ » ou «\ \-NAN\ ». .PP De même si \fIfp\fP est infini, il est converti en [\-]inf ou [\-]INF. .RE .PP Une chaîne \fIformat\fP malformée entraîne un comportement non défini. .SH "VALEUR RENVOYÉE" The \fBstrfromd\fP(), \fBstrfromf\fP(), and \fBstrfroml\fP() functions return the number of characters that would have been written in \fIstr\fP if \fIn\fP had enough space, not counting the terminating null byte. Thus, a return value of \fIn\fP or greater means that the output was truncated. .SH VERSIONS Les fonctions \fBstrfromd\fP(), \fBstrfromf\fP() et \fBstrfroml\fP() sont disponibles dans la glibc depuis la version\ 2.25. .SH ATTRIBUTS Pour une explication des termes utilisés dans cette section, consultez \fBattributes\fP(7) et la section \fBPOSIX Safety Concepts\fP dans le manuel de la Bibliothèque C GNU. .PP .TS allbox; lbw11 lb lb l l l. Interface Attribut Valeur T{ \fBstrfromd\fP(), \fBstrfromf\fP(), \fBstrfroml\fP() T} Sécurité des threads MT\-Safe locale \^ Sécurité des signaux asynchrones AS\-Unsafe heap \^ Sécurité des annulations asynchrones AC\-Unsafe mem .TE .sp 1 Note\ : ces attributs sont préliminaires .SH CONFORMITÉ C99, ISO/IEC\ TS\ 18661\-1. .SH NOTES Les fonctions \fBstrfromd\fP(), \fBstrfromf\fP() et \fBstrfroml\fP() prennent en compte la catégorie \fBLC_NUMERIC\fP de la locale utilisée. .SH 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\ »\ : .PP .in +4n .EX #define __STDC_WANT_IEC_60559_BFP_EXT__ #include int ssize = 10; char s[ssize]; strfromf(s, ssize, "%f", 12.1); .EE .in .PP 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\ »\ : .PP .in +4n .EX #define __STDC_WANT_IEC_60559_BFP_EXT__ #include int ssize = 10; char s[ssize]; strfromf(s, ssize, "%.2f", 12.3456); .EE .in .PP 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\ »\ : .PP .in +4n .EX #define __STDC_WANT_IEC_60559_BFP_EXT__ #include int ssize = 10; char s[ssize]; strfromd(s, ssize, "%.E", 12.345e19); .EE .in .SH "VOIR AUSSI" \fBatof\fP(3), \fBsnprintf\fP(3), \fBstrtod\fP(3) .SH COLOPHON Cette page fait partie de la publication\ 5.10 du projet \fIman\-pages\fP Linux. Une description du projet et des instructions pour signaler des anomalies et la dernière version de cette page peuvent être trouvées à l'adresse \%https://www.kernel.org/doc/man\-pages/. .SH TRADUCTION La traduction française de cette page de manuel a été créée par Christophe Blaess , Stéphan Rafin , Thierry Vignaud , François Micaux, Alain Portal , Jean-Philippe Guérard , Jean-Luc Coulon (f5ibh) , Julien Cristau , Thomas Huriaux , Nicolas François , Florentin Duneau , Simon Paillard , Denis Barbier , David Prévot et Grégoire Scano . Cette traduction est une documentation libre ; veuillez vous reporter à la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License version 3 .UE 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 à .MT debian-l10n-french@lists.debian.org .ME .