.\" -*- coding: UTF-8 -*-
.\" Copyright (c) 1980, 1991 Regents of the University of California.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" the American National Standards Committee X3, on Information
.\" Processing Systems.
.\"
.\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\" %%%LICENSE_END
.\"
.\"     @(#)setbuf.3	6.10 (Berkeley) 6/29/91
.\"
.\" Converted for Linux, Mon Nov 29 14:55:24 1993, faith@cs.unc.edu
.\" Added section to BUGS, Sun Mar 12 22:28:33 MET 1995,
.\"                   Thomas.Koenig@ciw.uni-karlsruhe.de
.\" Correction,  Sun, 11 Apr 1999 15:55:18,
.\"     Martin Vicente <martin@netadmin.dgac.fr>
.\" Correction,  2000-03-03, Andreas Jaeger <aj@suse.de>
.\" Added return value for setvbuf, aeb,
.\"
.\"*******************************************************************
.\"
.\" This file was generated with po4a. Translate the source file.
.\"
.\"*******************************************************************
.TH SETBUF 3 "6 mars 2019" Linux "Manuel du programmeur Linux"
.SH NOM
setbuf, setbuffer, setlinebuf, setvbuf \- Agir sur les tampons d'un flux
.SH SYNOPSIS
.nf
\fB#include <stdio.h>\fP
.PP
\fBvoid setbuf(FILE *\fP\fIstream\fP\fB, char *\fP\fIbuf\fP\fB);\fP
.PP
\fBvoid setbuffer(FILE *\fP\fIstream\fP\fB, char *\fP\fIbuf\fP\fB, size_t \fP\fIsize\fP\fB);\fP
.PP
\fBvoid setlinebuf(FILE *\fP\fIstream\fP\fB);\fP
.PP
\fBint setvbuf(FILE *\fP\fIstream\fP\fB, char *\fP\fIbuf\fP\fB, int \fP\fImode\fP\fB, size_t \fP\fIsize\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
\fBsetbuffer\fP(),
\fBsetlinebuf\fP():
    Since glibc 2.19:
        _DEFAULT_SOURCE
    Glibc 2.19 and earlier:
        _BSD_SOURCE
.SH DESCRIPTION
The three types of buffering available are unbuffered, block buffered, and
line buffered.  When an output stream is unbuffered, information appears on
the destination file or terminal as soon as written; when it is block
buffered many characters are saved up and written as a block; when it is
line buffered characters are saved up until a newline is output or input is
read from any stream attached to a terminal device (typically \fIstdin\fP).
The function \fBfflush\fP(3)  may be used to force the block out early.  (See
\fBfclose\fP(3).)
.PP
Normally all files are block buffered.  If a stream refers to a terminal (as
\fIstdout\fP normally does), it is line buffered.  The standard error stream
\fIstderr\fP is always unbuffered by default.
.PP
La fonction \fBsetvbuf\fP() peut être utilisée sur n'importe quel flux ouvert
pour modifier son type de tampon. La paramètre \fImode\fP doit correspondre à
l'une des constantes symboliques suivantes\ :
.RS
.TP 
\fB_IONBF\fP
pas de tampon
.TP 
\fB_IOLBF\fP
tampon de ligne
.TP 
\fB_IOFBF\fP
tampon complet
.RE
.PP
À l'exception des fichiers sans tampons, l'argument \fIbuf\fP doit pointer sur
un tampon contenant au moins \fIsize\fP octets. Ce nouveau tampon sera utilisé
à la place de l'ancien. Si l'argument \fIbuf\fP est NULL, seul le mode est
affecté. Un nouveau tampon sera alloué automatiquement lors de la prochaine
opération de lecture ou d'écriture. La fonction \fBsetvbuf\fP() ne peut être
utilisée qu'après l'ouverture du flux, et avant toute opération dessus.
.PP
Les trois autres appels sont, en fait, simplement des alias pour l'appel de
\fBsetvbuf\fP(). la fonction \fBsetbuf\fP() est exactement équivalente à
.PP
.in +4n
setvbuf(stream, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
.in
.PP
La fonction \fBsetbuffer\fP() est identique, sauf que la taille du tampon est
indiquée par l'appelant plutôt que la valeur par défaut \fBBUFSIZ\fP. La
fonction \fBsetlinebuf\fP() est exactement équivalente à\ :
.PP
.in +4n
setvbuf(stream, NULL, _IOLBF, 0);
.in
.SH "VALEUR RENVOYÉE"
La fonction \fBsetvbuf\fP() renvoie zéro si elle réussit. Elle renvoie une
valeur non nulle en cas d'échec (\fImode\fP n'est pas valable ou la requête ne
peut pas être honorée). Elle peut remplir \fIerrno\fP en cas d'erreur. Les
autres fonctions ne renvoient rien.
.PP
Les autres fonctions ne renvoient pas de valeur.
.SH ATTRIBUTS
Pour une explication des termes utilisés dans cette section, consulter
\fBattributes\fP(7).
.TS
allbox;
lbw23 lb lb
l l l.
Interface	Attribut	Valeur
T{
\fBsetbuf\fP(),
\fBsetbuffer\fP(),
.br
\fBsetlinebuf\fP(),
\fBsetvbuf\fP()
T}	Sécurité des threads	MT\-Safe
.TE
.SH CONFORMITÉ
Les fonctions \fBsetbuf\fP() et \fBsetvbuf\fP() sont conformes à C89 et C99.
.SH BOGUES
.\" The
.\" .BR setbuffer ()
.\" and
.\" .BR setlinebuf ()
.\" functions are not portable to versions of BSD before 4.2BSD, and
.\" are available under Linux since libc 4.5.21.
.\" On 4.2BSD and 4.3BSD systems,
.\" .BR setbuf ()
.\" always uses a suboptimal buffer size and should be avoided.
.\".PP
Il faut toujours s'assurer que le contenu de \fIbuf\fP existe encore au moment
de la fermeture du flux \fIstream\fP (qui se produit automatiquement à la fin
du programme). Par exemple, ceci n'est pas valable\ :
.PP
.EX
#include <stdio.h>

int
main(void)
{
    char buf[BUFSIZ];
    setbuf(stdin, buf);
    printf("Hello, world!\en");
    return 0;
}
.EE
.SH "VOIR AUSSI"
\fBstdbuf\fP(1), \fBfclose\fP(3), \fBfflush\fP(3), \fBfopen\fP(3), \fBfread\fP(3),
\fBmalloc\fP(3), \fBprintf\fP(3), \fBputs\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/.
.PP
.SH TRADUCTION
La traduction française de cette page de manuel a été créée par
Christophe Blaess <https://www.blaess.fr/christophe/>,
Stéphan Rafin <stephan.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.coulon@wanadoo.fr>,
Julien Cristau <jcristau@debian.org>,
Thomas Huriaux <thomas.huriaux@gmail.com>,
Nicolas François <nicolas.francois@centraliens.net>,
Florentin Duneau <fduneau@gmail.com>,
Simon Paillard <simon.paillard@resel.enst-bretagne.fr>,
Denis Barbier <barbier@debian.org>,
David Prévot <david@tilapin.org>
et
Frédéric Hantrais <fhantrais@gmail.com>
.
.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 .