puts, _putwsputs, _putws
Escribe una cadena en stdout.Writes a string to stdout.
SintaxisSyntax
int puts(
const char *str
);
int _putws(
const wchar_t *str
);
ParámetrosParameters
strstr
Cadena de salidaOutput string.
Valor devueltoReturn Value
Devuelve un valor no negativo si se ejecuta correctamente.Returns a nonnegative value if successful. Si se produce un error en puts , devuelve EOF; Si _putws produce un error, devuelve WEOF.If puts fails, it returns EOF; if _putws fails, it returns WEOF. Si Str es un puntero nulo, se invoca el controlador de parámetros no válidos, tal y como se describe en validación de parámetros.If str is a null pointer, the invalid parameter handler is invoked, as described in Parameter Validation. Si la ejecución puede continuar, las funciones establecen errno en EINVAL y devuelven EOF o WEOF.If execution is allowed to continue, the functions set errno to EINVAL and return EOF or WEOF.
Para obtener información sobre estos y otros códigos de error, vea _doserrno, errno, _sys_errlist y _sys_nerr.For information on these and other error codes, see _doserrno, errno, _sys_errlist, and _sys_nerr.
ObservacionesRemarks
La función puts escribe Str en el flujo de salida estándar stdout, reemplazando el carácter nulo de finalización de la cadena (' \ 0 ') por un carácter de nueva línea (' \n ') en el flujo de salida.The puts function writes str to the standard output stream stdout, replacing the string's terminating null character ('\0') with a newline character ('\n') in the output stream.
_putws es la versión de caracteres anchos de puts; las dos funciones se comportan exactamente igual si la secuencia se abre en modo ANSI._putws is the wide-character version of puts; the two functions behave identically if the stream is opened in ANSI mode. Put no admite actualmente la salida en un flujo Unicode.puts doesn't currently support output into a UNICODE stream.
_putwch escribe caracteres Unicode mediante la configuración regional actual de la consola._putwch writes Unicode characters using the current CONSOLE LOCALE setting.
De forma predeterminada, el ámbito de este estado global de esta función es la aplicación.By default, this function's global state is scoped to the application. Para cambiar esto, vea estado global en CRT.To change this, see Global state in the CRT.
Asignaciones de rutina de texto genéricoGeneric-Text Routine Mappings
Rutina TCHAR.HTCHAR.H routine | _UNICODE y _MBCS no definidos_UNICODE & _MBCS not defined | _MBCS definido_MBCS defined | _UNICODE definido_UNICODE defined |
---|---|---|---|
_putts_putts | putsputs | putsputs | _putws_putws |
RequisitosRequirements
RutinaRoutine | Encabezado necesarioRequired header |
---|---|
putsputs | <stdio.h> |
_putws_putws | <stdio.h> |
La consola no se admite en aplicaciones de Plataforma universal de Windows (UWP).The console is not supported in Universal Windows Platform (UWP) apps. Los identificadores de flujo estándar que están asociados a la consola, stdin, stdout y stderr deben redirigirse antes de que las funciones en tiempo de ejecución de C puedan usarlos en aplicaciones para UWP.The standard stream handles that are associated with the console, stdin, stdout, and stderr, must be redirected before C run-time functions can use them in UWP apps. Para obtener información adicional sobre compatibilidad, consulte Compatibilidad.For additional compatibility information, see Compatibility.
BibliotecasLibraries
Todas las versiones de las bibliotecas en tiempo de ejecución de C.All versions of the C run-time libraries.
EjemploExample
// crt_puts.c
// This program uses puts to write a string to stdout.
#include <stdio.h>
int main( void )
{
puts( "Hello world from puts!" );
}
SalidaOutput
Hello world from puts!
Vea tambiénSee also
E/S de secuenciaStream I/O
fputs, fputwsfputs, fputws
fgets, fgetwsfgets, fgetws