Espaços nominais
Variantes
Acções

gets, gets_s

Da cppreference.com
< c‎ | io

 
 
File input/output
Funções
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Arquivo de acesso
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.
Directa de entrada / saída
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
Não formatado entrada / saída
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.
Formatado de entrada / saída
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.
Arquivo de posicionamento
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
De tratamento de erros
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
Operações em arquivos
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)
stdin na matriz de caracteres apontada por str até que um caractere de nova linha é encontrada ou de fim-de-arquivo ocorre. 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.
caractere nulo é escrito imediatamente após o último caractere lido na matriz.
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)
Lê a maioria dos personagens n-1 de stdin na matriz apontada por str até erro de nova linha de caráter, o fim-de-arquivo, condição ou ler. Um personagem nulo é escrito imediatamente após o último caractere lido para a matriz, ou se não str[0] personagens foram lidas.
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.
@ @ Se n é zero ou é maior que RSIZE_MAX, um caractere nulo é escrito para str[0] mas a função lê e descarta personagens de stdin até erro de nova linha de caráter, o fim-de-arquivo, condição ou ler.
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.
@ @ Se os caracteres n-1 foram lidos, continua a ler e descartando os personagens de stdin até nova linha de caráter, o fim-de-arquivo, condição ou erro de leitura.
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.
@ @ A função gets_s é uma extensão e é opcional. É garantido para estar presente somente se __STDC_LIB_EXT1__ é definida.
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.

Índice

[editar] Parâmetros

str -
cadeia 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 em sucesso, NULL contrário
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

A função gets() não realiza verificação de limites, pois esta função é extremamente vulnerável a ataques de estouro de buffer. Ele não pode ser utilizado com segurança (a menos que o programa é executado num ambiente que restringe o que pode aparecer em stdin). Por este motivo, a função foi reprovada no terceiro rectificação ao padrão C99 e removido completamente no padrão C11. fgets() e gets_s() são as substituições 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 use gets().
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] Veja também

lê entrada formatada de stdin, um fluxo de arquivo ou um tampão
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.

(função) [edit]
recebe uma cadeia de caracteres a partir de um fluxo de arquivo
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.

(função) [edit]
escreve uma seqüência de caracteres para um fluxo de arquivo
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.

(função) [edit]