Espacios de nombres
Variantes
Acciones

gets, gets_s

De cppreference.com
< c‎ | io

 
 
File input/output
Funciones
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Acceso a archivos
Original:
File access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Directo de entrada / salida
Original:
Direct input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
fread
fwrite
Entrada sin formato / salida
Original:
Unformatted input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Formato de entrada / salida
Original:
Formatted input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Presentar posicionamiento
Original:
File positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ftell
fgetpos
fseek
fsetpos
rewind
Gestión de errores
Original:
Error handling
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
clearerr
feof
ferror
perror
Las operaciones en los archivos
Original:
Operations on files
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
remove
rename
tmpfile
tmpnam
 
Defined in header <stdio.h>
char *gets( char *str );
char *gets_s(char *str, rsize_t n);
(desde C11)(opcional)
1)
Lee stdin en la cadena de caracteres apuntada por str hasta que un carácter de nueva línea se encuentra o se produce al final de su archivo. A
Original:
Reads stdin into the character array pointed to by str until a newline character is found or end-of-file occurs. A
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
carácter nulo es escrito inmediatamente después del último carácter leído en el array .
Original:
null character is written immediately after the last character read into the array.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Lee en la mayoría de los personajes de n-1 stdin en el array apuntado por str hasta que la nueva línea de carácter, la condición de fin de archivo o error de lectura. Un carácter nulo es escrito inmediatamente después del último carácter leído en la matriz, o si no hay caracteres str[0] se leyeron .
Original:
Reads at most n-1 characters from stdin into the array pointed to by str until new-line character, end-of-file condition, or read error. A null character is written immediately after the last character read into the array, or to str[0] if no characters were read.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
@ @ Si n es cero o es mayor que RSIZE_MAX, un carácter nulo se escribe en str[0] pero la función lee y descarta los caracteres de stdin hasta que la nueva línea de carácter, la condición de fin de archivo o error de lectura .
Original:
@@ If n is zero or is greater than RSIZE_MAX, a null character is written to str[0] but the function reads and discards characters from stdin until new-line character, end-of-file condition, or read error.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
@ @ Si los caracteres n-1 han sido leídos, continúa leyendo y descartando los personajes de stdin hasta la nueva línea de carácter, la condición de fin de archivo o error de lectura .
Original:
@@ If n-1 characters have been read, continues reading and discarding the characters from stdin until new-line character, end-of-file condition, or read error.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
@ @ La función gets_s es una extensión y es opcional. Está garantizado para estar presente sólo si se define __STDC_LIB_EXT1__ .
Original:
@@ The gets_s function is an extension and is optional. It is guaranteed to be present only if __STDC_LIB_EXT1__ is defined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Contenido

[editar] Parámetros

str -
cadena de caracteres a ser escrito
Original:
character string to be written
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Valor de retorno

str en caso de éxito, NULL lo contrario
Original:
str on success, NULL otherwise
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Notas

La función gets() no realiza una comprobación de límites, por lo que esta función es extremadamente vulnerable a los ataques de desbordamiento de búfer. No se puede utilizar de forma segura (a menos que el programa se ejecuta en un entorno que limita lo que puede aparecer en stdin). Por esta razón, la función está desfasada y en la tercera corrección de la norma C99 y eliminado por completo en el estándar C11. fgets() y gets_s() son los reemplazos recomendadas .
Original:
The gets() function does not perform bounds checking, therefore this function is extremely vulnerable to buffer-overflow attacks. It cannot be used safely (unless the program runs in an environment which restricts what can appear on stdin). For this reason, the function has been deprecated in the third corrigendum to the C99 standard and removed altogether in the C11 standard. fgets() and gets_s() are the recommended replacements.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Nunca gets() usar .
Original:
Never use gets().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Ver también

lee la entrada con formato desde stdin, una secuencia de archivo o un tampón
Original:
reads formatted input from stdin, a file stream or a buffer
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función) [edit]
recibe una cadena de caracteres a partir de una secuencia de archivo
Original:
gets a character string from a file stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función) [edit]
escribe una cadena de caracteres en una secuencia de archivo
Original:
writes a character string to a file stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función) [edit]