C-style file input/output
Материал из 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. |
CI / O подмножество C + + библиотеки стандартных реализует C-стиле входного потока / вывода.
<cstdio> заголовок содержит общие поддержки операции с файлами и расходные материалы функций с узкими и многобайтовых символов входов / выходов, а <cwchar> заголовок предоставляет функции с широким диапазоном входного символа / выходов. 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.
C потоки являются объектами типа std::FILE, которые могут быть доступны только и управляется через указатели типа std::FILE* (Примечание: в то время как это может быть возможным, чтобы создать локальный объект типа std::FILE путем разыменования и копирования действительна FILE*, используя адрес такой копии в Функции ввода / вывода неопределенное поведение). Каждый поток C связан с внешними физического устройства (файл, стандартный входной поток, принтер, последовательный порт, и т.д.).
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.
C потоков могут быть использованы как для неформатированного и форматированный ввод и вывод. Они учетом локали и может выполнять широкий / многобайтовую преобразования по мере необходимости. В отличие от C + + потоков, где каждый поток связан с его собственным языка, все потоки C доступ к тем же объектом языка: одним из наиболее недавно установили с 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.
Кроме того, система конкретной информации, необходимой для доступа к устройству (например, дескрипторов файлов POSIX), каждый объект C потоке имеет место следующее:
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)
Персонаж ширина: узкий или широкий
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)
Буферизация состоянии: без буферизации, строка буферизации, с полной буферизацией.
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)
Буфера, который может быть заменен внешним, предоставленные пользователем буфер.
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 режим: вход, выход, или обновления (вход и выход).
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)
Binary / индикатор текстовом режиме.
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)
Заключительная файл индикатором состояния.
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)
Индикатор ошибки статус.
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)
Файл индикатор положения (объект типа std::fpos_t), который, для широкого потока характер, включает в себя разбор состояния (объект типа 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.
[править] Функции
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. | |
| открывает файл 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. (функция) | |
| открыть существующий поток с другим именем 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. (функция) | |
| закрывает файл 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. (функция) | |
| синхронизирует выходной поток с фактическим файл 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. (функция) | |
| переключает поток файлов между широкий символ I / O и узкий характер 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. (функция) | |
| задает буфер для файлового потока 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. (функция) | |
| устанавливает буфер и его размер файлового потока 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. (функция) | |
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. | |
| считывает данные из файла 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. (функция) | |
| пишет в файл 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. (функция) | |
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. | |
| получает символ из потока файлов 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. (функция) | |
| получает строку символов из файла потока 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. (функция) | |
| Записывает символ в поток файла 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. (функция) | |
| пишет символьная строка в файле поток 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. (функция) | |
| читает символ из 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. (функция) | |
| считывает строку символов, из 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. (функция) | |
| Записывает символ в 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. (функция) | |
| пишет строку символов 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. (функция) | |
| ставит символ обратно в поток файла 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. (функция) | |
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. | |
| получает широкий символ из потока файлов 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. (функция) | |
| получает широкое строки из файла потока 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. (функция) | |
| пишет широкого символа в файле поток 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. (функция) | |
| пишет широкого строку в файл поток 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. (функция) | |
| говорится в широкий символ из 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. (функция) | |
| пишет широкий характер 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. (функция) | |
| ставит широкий символ обратно в поток файла 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. (функция) | |
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. | |
| читается форматированный ввод из stdin, поток файл или буфер 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. (функция) | |
| (C++11) (C++11) (C++11) |
читается форматированный ввод из stdin, поток файла или buffer помощью переменной список аргументов 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. (функция) |
| (C++11) |
отпечатки отформатировать вывод stdout, поток файл или буфер 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. (функция) |
| отпечатки отформатировать вывод stdout, поток файла или buffer использованием переменного списка аргументов 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. (функция) | |
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. | |
| читает отформатированных широкий диапазон входного символа из stdin, поток файл или буфер 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. (функция) | |
| (C++11) (C++11) (C++11) |
читает отформатированных широкий диапазон входного символа из stdin, stream файл или буфер, используя переменный список аргументов 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. (функция) |
| отпечатки отформатирован широкий выход характера stdout, поток файл или буфер 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. (функция) | |
| отпечатки отформатирован широкий выход характера stdout, stream файл или буфер, используя переменный список аргументов 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. (функция) | |
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. | |
| Возвращает текущий индикатор позиции файла 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. (функция) | |
| получает индикатор позиции файла 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. (функция) | |
| перемещает индикатор позиции файла в определенное место в файле 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. (функция) | |
| перемещает индикатор позиции файла в определенное место в файле 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. (функция) | |
| перемещает индикатор позиции файла на начало в файл 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. (функция) | |
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. | |
| устраняет ошибки 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. (функция) | |
| проверка на конец файла 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. (функция) | |
| проверяет наличие файла ошибки 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. (функция) | |
| выводит строку символов, соответствующая текущей ошибки 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. (функция) | |
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. | |
| удаляет файл 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. (функция) | |
| переименовывает файл 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. (функция) | |
| создает и открывает временный, автоматическое удаление файлов 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. (функция) | |
| Возвращает уникальное имя файла 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. (функция) | |
[править] Типы
| Определено в файле <cstdio>
| |
| Type
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 | типа, способный вместить всю информацию, необходимую для управления 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 | типа, способных однозначно указать позицию в файле
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. |
[править] Макросы
| Определено в файле <cstdio>
| |
| stdin stdout stderr |
Выражение типа FILE* связанные с входом stream expression типа FILE*, связанный с выходом stream expression типа FILE*, связанных с потоком вывода ошибок 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. (константа-макрос) |
| EOF |
целочисленное постоянное выражение из int типа и отрицательное значение 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. (константа-макрос) |
| FOPEN_MAX |
число файлов, которые могут быть открыты одновременно 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. (константа-макрос) |
| FILENAME_MAX |
Размер необходимых для массив символов для хранения длинных имен файлов поддерживаются 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. (константа-макрос) |
| BUFSIZ |
Размер буфера, используемого 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. (константа-макрос) |
| _IOFBF _IOLBF _IONBF |
аргумент std::setbuf указанием полной буферизацией ввода / O argument в std::setbuf указывает линия буфер ввода / O argument в std::setbuf указывает небуферизованных I / 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. (константа-макрос) |
| SEEK_SET SEEK_CUR SEEK_END |
аргумент std::fseek указывает ищет с начала file argument в std::fseek указывает ищет от текущей position argument файл std::fseek указывает ищет с конца файла 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. (константа-макрос) |
| TMP_MAX |
Максимальное количество уникальных имен файлов, которые могут быть получены путем 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. (константа-макрос) |
| L_tmpnam |
Размер необходимых для массив символов провести результате 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. (константа-макрос) |