.\" -*- 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 .\" Correction, 2000-03-03, Andreas Jaeger .\" Added return value for setvbuf, aeb, .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH SETBUF 3 "6 Marzo 2019" Linux "Manual del Programador de Linux" .SH NOMBRE setbuf, setbuffer, setlinebuf, setvbuf \- operaciones sobre búferes de flujos .SH SINOPSIS .nf \fB#include \fP .PP \fBvoid setbuf(FILE *\fP\fIflujo\fP\fB, char *\fP\fIbuf\fP\fB);\fP .PP \fBvoid setbuffer(FILE *\fP\fIflujo\fP\fB, char *\fP\fIbuf\fP\fB, size_t\fP\fItam\fP\fB);\fP .PP \fBvoid setlinebuf(FILE *\fP\fIflujo\fP\fB);\fP .PP \fBint setvbuf(FILE *\fP\fIflujo\fP\fB, char *\fP\fIbuf\fP\fB, int \fP\fImodo\fP \fB, size_t \fP\fItam\fP\fB);\fP .fi .PP .RS -4 Requisitos de Macros de Prueba de Características para glibc (véase \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 DESCRIPCIÓN Los tres tipos disponibles de estrategias de asignación de búferes son sin búfer, con búfer de bloque, y con búfer de línea. Cuando un flujo de salida está sin búfer, la información aparece en el fichero de destino o en la terminal tan pronto como se escribe; cuando está con búfer de bloque se guardan y escriben muchos caracteres como un bloque; cuando está con búfer de línea los caracteres se van guardando hasta que se da un salto de línea o si la entrada se lee de cualquier flujo asociado a un dispositivo de terminal (normalmente la entrada estándar stdin). Se puede emplear la función \fBfflush\fP(3) para forzar la escritura del bloque más pronto de la cuenta. (Vea \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 The \fBsetvbuf\fP() function may be used on any open stream to change its buffer. The \fImode\fP argument must be one of the following three macros: .RS .TP \fB_IONBF\fP sin búfer .TP \fB_IOLBF\fP búfer de línea .TP \fB_IOFBF\fP búfer completo .RE .PP Salvo para ficheros sin búfer, el argumento \fIbuf\fP debería apuntar a un búfer de al menos \fItam\fP bytes de grande; este búfer se utilizará en lugar del actual. Si el argumento \fIbuf\fP es NULL, sólo el modo se ve afectado; se obtendrá un nuevo búfer en la siguiente operación de lectura o escritura. La función \fIsetvbuf\fP() puede ser usada solamente después de abrir un flujo y antes de que ninguna otra operación se haya realizado sobre él. .PP Las otras tres funciones son, en efecto, simplemente otras formas simplificadas de llamar a \fBsetvbuf\fP(). La función \fBsetbuf\fP() es exactamente equivalente a la llamada .PP .in +4n setvbuf(flujo, buf, buf ? _IOFBF : _IONBF, BUFSIZ); .in .PP La función \fBsetbuffer\fP() es lo mismo, excepto en que el tamaño del búfer se deja a la discreción del usuario, en vez de estar determinado por el valor por omisión \fBBUFSIZ\fP. La función \fBsetlinebuf\fP() es exactamente equivalente a la llamada: .PP .in +4n setvbuf(stream, NULL, _IOLBF, 0); .in .SH "VALOR DEVUELTO" The function \fBsetvbuf\fP() returns 0 on success. It returns nonzero on failure (\fImode\fP is invalid or the request cannot be honored). It may set \fIerrno\fP on failure. .PP The other functions do not return a value. .SH ATRIBUTOS Para obtener una explicación de los términos usados en esta sección, véase \fBattributes\fP(7). .TS allbox; lbw23 lb lb l l l. Interfaz Atributo Valor T{ \fBsetbuf\fP(), \fBsetbuffer\fP(), .br \fBsetlinebuf\fP(), \fBsetvbuf\fP() T} Seguridad del hilo Multi\-hilo seguro .TE .SH "CONFORME A" The \fBsetbuf\fP() and \fBsetvbuf\fP() functions conform to C89 and C99. .SH ERRORES .\" 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 You must make sure that the space that \fIbuf\fP points to still exists by the time \fIstream\fP is closed, which also happens at program termination. For example, the following is invalid: .PP .EX #include int main(void) { auto char buf[BUFSIZ]; setbuf(stdin, buf); printf("¡Hola a todos!\en"); return 0; /* Se destruye buf, se cierra stdin */ } .EE .SH "VÉASE TAMBIÉN" \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 COLOFÓN Esta página es parte de la versión 5.10 del proyecto Linux \fIman\-pages\fP. Puede encontrar una descripción del proyecto, información sobre cómo informar errores y la última versión de esta página en \%https://www.kernel.org/doc/man\-pages/. .SH TRADUCCIÓN La traducción al español de esta página del manual fue creada por Gerardo Aburruzaga García , Juan Piernas y Miguel Pérez Ibars . Esta traducción es documentación libre; lea la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 .UE o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD. Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a .MT debian-l10n-spanish@lists.debian.org>. .ME .