C-style file input/output
Da cppreference.com
![]() | This page has been machine-translated from the English version of the wiki using Google Translate. The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
O subconjunto CI / O do C + + biblioteca padrão implementa C-estilo fluxo de entrada / saída operações. O cabeçalho
<cstdio>
fornece suporte à operação genérica arquivo e funções de suprimentos com estreitas e multibyte caracteres de entrada / saída de recursos, eo cabeçalho <cwchar>
fornece funções com a entrada de caracteres de largura / capacidades de saída. Original:
The C I/O subset of the C++ standard library implements C-style stream input/output operations. The
<cstdio>
header provides generic file operation support and supplies functions with narrow and multibyte character input/output capabilities, and the <cwchar>
header provides functions with wide character input/output capabilities. The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Fluxos C são objetos de std::FILE tipo que só podem ser acessados e manipulados através de ponteiros da Nota tipo std::FILE* (: embora possa ser possível criar um objeto local de std::FILE tipo por dereferencing e copiar um FILE* válido, usando o endereço de tal cópia em as funções de I / O é um comportamento indefinido). Cada fluxo C está associada a um dispositivo externo físico (arquivo, fluxo de entrada padrão, impressora, porta serial, etc).
Original:
C streams are objects of type std::FILE that can only be accessed and manipulated through pointers of type std::FILE* (Note: while it may be possible to create a local object of type std::FILE by dereferencing and copying a valid FILE*, using the address of such copy in the I/O functions is undefined behavior). Each C stream is associated with an external physical device (file, standard input stream, printer, serial port, etc).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Fluxos C pode ser usado tanto para entrada como não formatado e formatado e saída. Eles são sensíveis à localidade e pode realizar amplas / multibyte conversões necessárias. Ao contrário de C + + riachos, onde cada fluxo está associado com a sua própria localidade, todos os fluxos de C acessar o objeto mesmo local: o mais recentemente instalado com std::setlocale.
Original:
C streams can be used for both unformatted and formatted input and output. They are locale-sensitive and may perform wide/multibyte conversions as necessary. Unlike C++ streams, where each stream is associated with its own locale, all C streams access the same locale object: the one most recently installed with std::setlocale.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Além do sistema de informações específicas necessárias para acessar o dispositivo (por exemplo, um descritor de arquivo POSIX), cada objeto de fluxo de C tem o seguinte:
Original:
Besides the system-specific information necessary to access the device (e.g. a POSIX file descriptor), each C stream object holds the following:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
1)
Largura de caractere: estreita ou larga
Original:
Character width: narrow or wide
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
2)
Buffer estado: unbuffered, linha-tampão, com buffer.
Original:
Buffering state: unbuffered, line-buffered, fully buffered.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
3)
O tampão, o qual pode ser substituído por uma fonte externa, tampão fornecido pelo utilizador.
Original:
The buffer, which may be replaced by an external, user-provided buffer.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
4)
I / O modo: de entrada, de saída, ou de atualização (entrada e saída).
Original:
I/O mode: input, output, or update (both input and output).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
5)
Binário / indicador do modo texto.
Original:
Binary/text mode indicator.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
6)
Fim-de-arquivo indicador de status.
Original:
End-of-file status indicator.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
7)
Indicador de status de erro.
Original:
Error status indicator.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
8)
Indicador de posição do arquivo (um objeto do tipo std::fpos_t), que, para fluxos de caracteres de largura, inclui o estado parse (um objeto do tipo mbstate_t).
Original:
File position indicator (an object of type std::fpos_t), which, for wide character streams, includes the parse state (an object of type mbstate_t).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar]Funções
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. | |
abre um arquivo Original: opens a file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
abrir um córrego existente com um nome diferente Original: open an existing stream with a different name The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
fecha um arquivo Original: closes a file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
sincroniza um fluxo de saída com o arquivo real Original: synchronizes an output stream with the actual file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
muda um fluxo de arquivos entre o personagem de largura I / O e caráter estreito I / O Original: switches a file stream between wide character I/O and narrow character I/O The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
define o buffer para um fluxo de arquivo Original: sets the buffer for 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) | |
define o tampão e do seu tamanho para um fluxo de arquivo Original: sets the buffer and its size for 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) | |
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. | |
lê um arquivo Original: reads from a file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
grava em um arquivo Original: writes to a file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
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. | |
Original: Narrow character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
recebe um personagem de um fluxo de arquivo Original: gets a character 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) | |
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) | |
escreve um personagem para um fluxo de arquivo Original: writes a character 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) | |
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) | |
lê um caracter do stdin Original: reads a character from stdin The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
lê uma cadeia de caracteres de stdin Original: reads a character string from stdin The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
escreve um personagem para stdout Original: writes a character to stdout The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
escreve uma cadeia de caracteres para stdout Original: writes a character string to stdout The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
coloca um personagem de volta em um fluxo de arquivo Original: puts a character back into 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) | |
Original: Wide character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
recebe um caractere largo de um fluxo de arquivo Original: gets a wide character 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) | |
recebe uma seqüência de largura a partir de um fluxo de arquivo Original: gets a wide 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) | |
escreve um caráter amplo para um fluxo de arquivo Original: writes a wide character 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) | |
escreve uma string de gama a um fluxo de arquivo Original: writes a wide 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) | |
lê um caractere largo de stdin Original: reads a wide character from stdin The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
escreve um caráter amplo para stdout Original: writes a wide character to stdout The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
coloca um caractere largo de volta em um fluxo de arquivo Original: puts a wide character back into 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) | |
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. | |
Original: Narrow/multibyte character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
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) | |
(C++11) (C++11) (C++11) | lê entrada formatada de stdin, um fluxo de arquivo ou um buffer usando lista de argumentos variável Original: reads formatted input from stdin, a file stream or a buffer using variable argument list The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) |
(C++11) | impressões saída formatada para stdout, um fluxo de arquivo ou um tampão Original: prints formatted output to stdout, 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) |
impressões saída formatada para stdout, um fluxo de arquivo ou um buffer usando lista de argumentos variável Original: prints formatted output to stdout, a file stream or a buffer using variable argument list The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
Original: Wide character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
lê a entrada de caracteres formatada variedade de stdin, um fluxo de arquivo ou um tampão Original: reads formatted wide character 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) | |
(C++11) (C++11) (C++11) | lê a entrada de caracteres formatada variedade de stdin, um stream arquivo ou um buffer usando lista de argumentos variável Original: reads formatted wide character input from stdin, a file stream or a buffer using variable argument list The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) |
impressões formatado saída de caracteres de largura para stdout, um fluxo de arquivo ou um tampão Original: prints formatted wide character output to stdout, 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) | |
impressões formatado saída de caracteres de largura para stdout, um stream arquivo ou um buffer usando lista de argumentos variável Original: prints formatted wide character output to stdout, a file stream or a buffer using variable argument list The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
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. | |
retorna o indicador de posição de arquivo atual Original: returns the current file position indicator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
fica o indicador de posição de arquivo Original: gets the file position indicator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
move o indicador de posição de arquivo para um local específico em um arquivo Original: moves the file position indicator to a specific location in a file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
move o indicador de posição de arquivo para um local específico em um arquivo Original: moves the file position indicator to a specific location in a file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
move o indicador de posição do arquivo para o início em um arquivo Original: moves the file position indicator to the beginning in a file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
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. | |
elimina erros Original: clears errors The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
cheques para o fim-de-arquivo Original: checks for the end-of-file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
verifica um erro de arquivo Original: checks for a file error The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
exibe uma seqüência de caracteres correspondente do erro atual para stderr Original: displays a character string corresponding of the current error to stderr The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
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. | |
apaga um arquivo Original: erases a file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
Renomeia um arquivo Original: renames a file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
cria e abre um temporário, arquivo auto de remoção Original: creates and opens a temporary, auto-removing file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
retorna um nome único Original: returns a unique filename The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) |
[editar]Tipos
Defined in header <cstdio> | |
Tipo Original: Type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | Definition |
FILE | tipo, capaz de reter todos os dados necessários para controlar um fluxo de CI / O Original: type, capable of holding all information needed to control a C I/O stream The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
fpos_t | tipo, capaz de especificar de forma exclusiva uma posição em um arquivo Original: type, capable of uniquely specifying a position in a file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[editar]Macros
Defined in header <cstdio> | |
stdin stdout stderr | expressão do tipo FILE* associado à entrada de stream expression FILE* tipo associado com a saída de stream expression FILE* tipo associado com o fluxo de saída de erro Original: expression of type FILE* associated with the input stream expression of type FILE* associated with the output stream expression of type FILE* associated with the error output stream The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (macro constante) |
EOF | expressão constante inteira de int tipo e valor negativo Original: integer constant expression of type int and negative value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (macro constante) |
FOPEN_MAX | número de arquivos que podem ser abertas simultaneamente Original: number of files that can be open simultaneously The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (macro constante) |
FILENAME_MAX | tamanho necessário para uma matriz de char para segurar o maior nome de arquivo suportado Original: size needed for an array of char to hold the longest supported file name The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (macro constante) |
BUFSIZ | tamanho da memória tampão usada pelo std::setbuf Original: size of the buffer used by std::setbuf The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (macro constante) |
_IOFBF _IOLBF _IONBF | argumento para std::setbuf indicando fully buffered I / O argument a linha std::setbuf indicando tamponado eu O argument / para std::setbuf indicando que eu unbuffered / O Original: argument to std::setbuf indicating fully buffered I/O argument to std::setbuf indicating line buffered I/O argument to std::setbuf indicating unbuffered I/O The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (macro constante) |
SEEK_SET SEEK_CUR SEEK_END | argumento para std::fseek indicando buscando de início do file argument para std::fseek indicando busca do position argument arquivo atual para std::fseek indicando buscando a partir do final do arquivo Original: argument to std::fseek indicating seeking from beginning of the file argument to std::fseek indicating seeking from the current file position argument to std::fseek indicating seeking from end of the file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (macro constante) |
TMP_MAX | número máximo de nomes de ficheiros originais que podem ser gerados por std::tmpnam Original: maximum number of unique filenames that can be generated by std::tmpnam The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (macro constante) |
L_tmpnam | tamanho necessário para uma matriz de char para segurar o resultado de std::tmpnam Original: size needed for an array of char to hold the result of std::tmpnam The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (macro constante) |