.\" -*- coding: UTF-8 -*- '\" t .\" Copyright 1993, David Metcalfe .\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH strtoul 3 "8 février 2026" "Pages du manuel de Linux 6.18" .SH NOM strtoul, strtoull, strtouq \- Convertir une chaîne en entier long non signé .SH BIBLIOTHÈQUE Bibliothèque C standard (\fIlibc\fP,\ \fI\-lc\fP) .SH SYNOPSIS .nf \fB#include \fP .P \fBunsigned long strtoul(const char *restrict \fP\fInptr\fP\fB,\fP \fB char **_Nullable restrict \fP\fIendptr\fP\fB, int \fP\fIbase\fP\fB);\fP \fBunsigned long long strtoull(const char *restrict \fP\fInptr\fP\fB,\fP \fB char **_Nullable restrict \fP\fIendptr\fP\fB, int \fP\fIbase\fP\fB);\fP .fi .P .RS -4 Exigences de macros de test de fonctionnalités pour la glibc (consulter \fBfeature_test_macros\fP(7)) : .RE .P \fBstrtoull\fP() : .nf _ISOC99_SOURCE || /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE .fi .SH DESCRIPTION La fonction \fBstrtoul\fP() convertit le début de la chaîne \fInptr\fP en une valeur de type \fIunsigned long\fP en fonction de l'argument \fIbase\fP, qui doit être dans l'intervalle \fB2\fP à \fB36\fP (bornes comprises), ou avoir la valeur spéciale \fB0\fP. .P The string may begin with an arbitrary amount of white space (as determined by \fBisspace\fP(3)) followed by a single optional \[aq]+\[aq] or \[aq]\-\[aq] sign. If \fIbase\fP is zero or 16, the string may then include a "0x" or "0X" prefix, and the number will be read in base 16; if \fIbase\fP is zero or 2, the string may then include a "0b" or "0B" prefix, and the number will be read in base 2; otherwise, a zero \fIbase\fP is taken as 10 (decimal) unless the next character is \[aq]0\[aq], in which case it is taken as 8 (octal). .P Le reste de la chaîne est converti en une valeur de type \fIunsigned long\fP, en s'arrêtant au premier caractère qui n'est pas un chiffre valable dans la base indiquée. Dans les bases supérieures à \fB10\fP, la lettre «\ A\ » (majuscule ou minuscule) représente \fB10\fP, «\ B\ » représente \fB11\fP, et ainsi de suite jusqu'à «\ Z\ » représentant \fB35\fP. .P Si \fIendptr\fP n'est pas NULL et \fIbase\fP est prise en charge, \fBstrtoul\fP() stocke l'adresse du premier caractère non autorisé dans \fI*endptr\fP. S'il n'y a aucun chiffre, \fBstrtoul\fP() stocke la valeur originale de \fInptr\fP dans \fI*endptr\fP (et renvoie \fB0\fP). En particulier, si \fI*nptr\fP n'est pas « \[rs]0\ » et si \fI**endptr\fP vaut « \[rs]0\ » en retour, la chaîne entière est valable. .P La fonction \fBstrtoull\fP() fonctionne comme \fBstrtoul\fP(), mais renvoie une valeur entière de type \fIunsigned long long\fP. .SH "VALEUR RENVOYÉE" The \fBstrtoul\fP() function returns either the result of the conversion, or, if there was a leading minus sign, the negation of the result of the conversion represented as an unsigned value, unless the original (nonnegated) value would overflow; in the latter case, \fBstrtoul\fP() returns \fBULONG_MAX\fP and sets \fIerrno\fP to \fBERANGE\fP. Precisely the same holds for \fBstrtoull\fP() (with \fBULLONG_MAX\fP instead of \fBULONG_MAX\fP). .SH ERREURS Cette fonction ne modifie par \fIerrno\fP en cas de succès. .TP \fBEINVAL\fP (pas dans C99) La \fIbase\fP indiquée n'est pas prise en charge. .TP \fBERANGE\fP La valeur retournée est hors limites. .P L'implémentation peut aussi mettre \fIerrno\fP à \fBEINVAL\fP si aucune conversion n'a été réalisée (pas de chiffres trouvés, et \fB0\fP renvoyé). .SH ATTRIBUTS Pour une explication des termes utilisés dans cette section, consulter \fBattributes\fP(7). .TS allbox; lbx lb lb l l l. Interface Attribut Valeur T{ .na .nh \fBstrtoul\fP(), \fBstrtoull\fP(), \fBstrtouq\fP() T} Sécurité des threads MT\-Safe locale .TE .SH VERSIONS Dans des localisations autres que «\ C\ », d'autres chaînes peuvent être acceptées. Par exemple, un signe séparateur de milliers pour la localisation utilisée peut être accepté. .P BSD a aussi .P .in +4n .EX \fBu_quad_t strtouq(const char *\fP\fInptr\fP\fB, char **\fP\fIendptr\fP\fB, int \fP\fIbase\fP\fB);\fP .EE .in .P avec une définition exactement analogue. Suivant l'architecture, cela peut être équivalent à \fBstrtoull\fP() ou \fBstrtoul\fP(). .SH NORMES C23, POSIX.1\-2024. .SH HISTORIQUE .TP \fBstrtoul\fP() POSIX.1\-2001, C89, SVr4. .TP \fBstrtoull\fP() POSIX.1\-2001, C99. .TP "0b", "0B" C23. glibc 2.38. (Not in POSIX.) .SH AVERTISSEMENTS Comme \fBstrtoul\fP() peut légitimement renvoyer \fB0\fP ou \fBULONG_MAX\fP (\fBULLONG_MAX\fP pour \fBstrtoull\fP()) à la fois en cas de succès et d'échec, le programme appelant doit positionner \fIerrno\fP à \fB0\fP avant l'appel, et déterminer si une erreur s'est produite en regardant si \fIerrno\fP a une valeur non nulle après l'appel. .SH BOGUES .SS "Signed numbers" Some negative values are considered valid input and are silently converted to \fI\%unsigned\ long\fP. .SS "White space" These functions silently accept leading whitespace. .SS isalnum(3) To reject white space and/or a sign, call \fBisalnum\fP(3) before \fBstrtoul\fP(). .SH EXEMPLES Consultez l'exemple dans la page de manuel \fBstrtol\fP(3)\ ; l'utilisation des fonctions décrites dans cette page de manuel est identique. .SH "VOIR AUSSI" \fBa64l\fP(3), \fBatof\fP(3), \fBatoi\fP(3), \fBatol\fP(3), \fBstrtod\fP(3), \fBstrtol\fP(3), \fBstrtoumax\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 .