.\" -*- coding: UTF-8 -*- '\" t .\" Copyright (c) 2016, IBM Corporation. .\" Written by Wainer dos Santos Moschetta .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .\" 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 "5 février 2023" "Pages du manuel de Linux 6.03" .SH NOM strfromd, strfromf, strfroml \- Convertir des nombres en virgule flottante en chaînes de caractères .SH BIBLIOTHÈQUE Bibliothèque C standard (\fIlibc\fP, \fI\-lc\fP) .SH SYNOPSIS .nf \fB#include \fP .PP \fBint strfromd(char \fP\fIstr\fP\fB[restrict .\fP\fIn\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 \fP\fIstr\fP\fB[restrict .\fP\fIn\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 \fP\fIstr\fP\fB[restrict .\fP\fIn\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 \fBstrfromd\fP(), \fBstrfromf\fP(), \fBstrfroml\fP()\ : .nf __STDC_WANT_IEC_60559_BFP_EXT__ .fi .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 "CHAÎNE DE FORMAT" The \fIformat\fP string must start with the character \[aq]%\[aq]. This is followed by an optional precision which starts with the period character (.), followed by an optional decimal integer. If no integer is specified after the period character, a precision of zero is used. Finally, the format string should have one of the conversion specifiers \fBa\fP, \fBA\fP, \fBe\fP, \fBE\fP, \fBf\fP, \fBF\fP, \fBg\fP, or \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 The \fBstrfromd\fP(), \fBstrfromf\fP(), and \fBstrfroml\fP() functions are available since glibc 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 .ad l .nh .TS allbox; lbx lb lb l l l. Interface Attribut Valeur T{ \fBstrfromd\fP(), \fBstrfromf\fP(), \fBstrfroml\fP() T} Sécurité des threads MT\-Safe locale \^ Async\-signal safety AS\-Unsafe heap \^ Async\-cancel safety AC\-Unsafe mem .TE .hy .ad .sp 1 Note\ : ces attributs sont préliminaires .SH STANDARDS 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) .PP .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 . .PP 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. .PP 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 .