Пространства имён
Варианты
Действия

std::vscanf, std::vfscanf, std::vsscanf

Материал из cppreference.com
< cpp | io | c

 
 
Библиотеки ввода / вывода
I / O манипуляторов
C-стиль I / O
Буферы
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(устарело)
Потоки
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Абстракций
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
Файл I / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
Струнный I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
Массив I / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(устарело)
ostrstream(устарело)
strstream(устарело)
Типы
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
Интерфейс Ошибка категории
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
C-стиль I / O
Функции
Original:
Functions
The text has been machine-translated via Google Translate.
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:
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
Неформатированная ввода / вывода
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:
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.
scanf
fscanf
sscanf
vscanf
vfscanf
vsscanf
(C++11)
(C++11)
(C++11)
printf
fprintf
sprintf
snprintf



(C++11)
vprintf
vfprintf
vsprintf
vsnprintf



(C++11)
Позиционирование файла
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
Обработка ошибок
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
Операции с файлами
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
 
Заголовочный файл <cstdio>
int vscanf( const char *format, va_list vlist );
(1) (начиная с C++11)
int vfscanf( FILE *stream, const char *format, va_list vlist );
(2) (начиная с C++11)
int vsscanf( const char *buffer, const char *format, va_list vlist );
(3) (начиная с C++11)
Читает данные из различных источников, интерпретирует его в соответствии с format и сохраняет результаты в определенных местах vlist.
Original:
Reads data from the a variety of sources, interprets it according to format and stores the results into locations defined by vlist.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
Считывает данные из stdin.
Original:
Reads the data from stdin.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Читает данные из файла stream поток.
Original:
Reads the data from file stream stream.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
Считывает данные с нулевым buffer буквенная.
Original:
Reads the data from null-terminated character string buffer.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Содержание

[править] Параметры

stream -
Поток входной файл для чтения
Original:
input file stream to read from
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
buffer -
Указатель на завершающуюся нулем строку символов для чтения
Original:
pointer to a null-terminated character string to read from
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
format -
Указатель на завершающуюся нулем строку, определяющую характер, как читать ввод.
Строка формата состоит из пробельных символов (любой одиночный символ пробела в строке формата потребляет все доступные последовательные пробельные символы из входной), без пробелов символы, кроме % (каждый такой символ в формате строки потребляет ровно один идентичный символ из входного) и технические преобразования. Каждая спецификация преобразования имеет следующий формат:
Original:
The format string consists of whitespace characters (any single whitespace character in the format string consumes all available consecutive whitespace characters from the input), non-whitespace characters except % (each such character in the format strings consumes exactly one identical character from the input) and conversion specifications. Each conversion specification has the following format:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • вводный характер %
    Original:
    introductory % character
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • (необязательно) назначения подавляющих * характер. Если этот параметр присутствует, то функция не присвоить результат преобразования в любое получение аргумент.
    Original:
    (необязательно) assignment-suppressing character *. If this option is present, the function does not assign the result of the conversion to any receiving argument.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • (необязательно) целое число (больше нуля), который определяет максимальное' ширины поля, то есть максимальное количество символов, которое функция разрешено потреблять при выполнении преобразования, указанного в текущем спецификации преобразования. Обратите внимание, что% S и% [может привести к переполнению буфера, если ширина не предусмотрено.
    Original:
    (необязательно) integer number (greater than zero) that specifies maximum field width, that is, the maximum number of characters that the function is allowed to consume when doing the conversion specified by the current conversion specification. Note that %s and %[ may lead to buffer overflow if the width is not provided.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • (необязательно)' длина модификатора, который определяет размер принимающего аргумент, то есть фактический тип назначения. Это влияет на точность преобразования и переполнения правил. По умолчанию тип назначения различна для каждого преобразования типов (см. таблицу ниже).
    Original:
    (необязательно) length modifier that specifies the size of the receiving argument, that is, the actual destination type. This affects the conversion accuracy and overflow rules. The default destination type is different for each conversion type (see table below).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Преобразование формата
    Original:
    conversion format specifier
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
Следующие спецификаторы формата доступны
Original:
The following format specifiers are available:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Conversion
specifier
Explanation Argument type
length modifier hh h (none) l ll j z t L
% matches literal % N/A N/A N/A N/A N/A N/A N/A N/A N/A
c matches a single character N/A N/A
char*
wchar_t*
N/A N/A N/A N/A N/A
s matches a character string (a sequence of non-whitespace characters)
[set]
соответствует непустая последовательность символов из set символов.
Original:
matches a non-empty sequence of character from set of characters.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Если первый символ из набора ^, то все символы, не в наборе совпадают. Если набор начинается с ] или ^] то ] характера также входит в комплект.
Original:
If the first character of the set is ^, then all characters not in the set are matched. If the set begins with ] or ^] then the ] character is also included into the set.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
d
Совпадает с 'десятичное целое.
Original:
matches a decimal integer'.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Формат числа так же, как ожидается strtol() со значением 10 для base аргумент
Original:
The format of the number is the same as expected by strtol() with the value 10 for the base argument
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
signed char* or unsigned char*
signed short* or unsigned short*
signed int* or unsigned int*
signed long* or unsigned long*
signed long long* or unsigned long long*
intmax_t* or uintmax_t*
size_t*
ptrdiff_t*
N/A
i
Совпадает с 'десятичное целое.
Original:
matches a decimal integer'.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Формат числа так же, как ожидается strtol() со значением 0 для base аргумент
Original:
The format of the number is the same as expected by strtol() with the value 0 for the base argument
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
u
соответствует 'беззнаковое десятичное целое'.
Original:
matches a unsigned decimal integer.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Формат числа так же, как ожидается strtoul() со значением 0 для base аргумент
Original:
The format of the number is the same as expected by strtoul() with the value 0 for the base argument
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
o
соответствует 'восьмеричное целое'.
Original:
matches an octal integer.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Формат числа так же, как ожидается strtol() со значением 8 для base аргумент
Original:
The format of the number is the same as expected by strtol() with the value 8 for the base argument
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
x
Совпадает с 'шестнадцатеричное целое.
Original:
matches an hexadecimal integer'.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Формат числа так же, как ожидается strtol() со значением 16 для base аргумент
Original:
The format of the number is the same as expected by strtol() with the value 16 for the base argument
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
n
возвращает "Количество символов читал до сих пор .
Original:
returns the number of characters read so far'.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Нет входного потребляется. Не увеличивать количество назначения. Если спецификатор имеет назначение подавляющего оператора определена, поведение не определено
Original:
No input is consumed. Does not increment the assignment count. If the specifier has assignment-suppressing operator defined, the behavior is undefined
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
a, A
e, E
f, F
g, G
соответствует "число с плавающей точкой .
Original:
matches a floating-point number'.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Формат числа так же, как ожидается strtof()
Original:
The format of the number is the same as expected by strtof()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
N/A N/A
float*
double*
N/A N/A N/A N/A
long double*
p
соответствует реализации определены последовательность символов, определяющая 'указатель'.
Original:
matches implementation defined character sequence defining a pointer.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
printf семейство функций следует производить в той же последовательности использования %p формата
Original:
printf family of functions should produce the same sequence using %p format specifier
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
N/A N/A
void**
N/A N/A N/A N/A N/A N/A
Original:
pointer to a null-terminated character string specifying how to read the input.
Строка формата состоит из пробельных символов (любой одиночный символ пробела в строке формата потребляет все доступные последовательные пробельные символы из входной), без пробелов символы, кроме % (каждый такой символ в формате строки потребляет ровно один идентичный символ из входного) и технические преобразования. Каждая спецификация преобразования имеет следующий формат:
Original:
The format string consists of whitespace characters (any single whitespace character in the format string consumes all available consecutive whitespace characters from the input), non-whitespace characters except % (each such character in the format strings consumes exactly one identical character from the input) and conversion specifications. Each conversion specification has the following format:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • вводный характер %
    Original:
    introductory % character
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • (необязательно) назначения подавляющих * характер. Если этот параметр присутствует, то функция не присвоить результат преобразования в любое получение аргумент.
    Original:
    (необязательно) assignment-suppressing character *. If this option is present, the function does not assign the result of the conversion to any receiving argument.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • (необязательно) целое число (больше нуля), который определяет максимальное' ширины поля, то есть максимальное количество символов, которое функция разрешено потреблять при выполнении преобразования, указанного в текущем спецификации преобразования. Обратите внимание, что% S и% [может привести к переполнению буфера, если ширина не предусмотрено.
    Original:
    (необязательно) integer number (greater than zero) that specifies maximum field width, that is, the maximum number of characters that the function is allowed to consume when doing the conversion specified by the current conversion specification. Note that %s and %[ may lead to buffer overflow if the width is not provided.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • (необязательно)' длина модификатора, который определяет размер принимающего аргумент, то есть фактический тип назначения. Это влияет на точность преобразования и переполнения правил. По умолчанию тип назначения различна для каждого преобразования типов (см. таблицу ниже).
    Original:
    (необязательно) length modifier that specifies the size of the receiving argument, that is, the actual destination type. This affects the conversion accuracy and overflow rules. The default destination type is different for each conversion type (see table below).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Преобразование формата
    Original:
    conversion format specifier
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
Следующие спецификаторы формата доступны
Original:
The following format specifiers are available:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Conversion
specifier
Explanation Argument type
length modifier hh h (none) l ll j z t L
% matches literal % N/A N/A N/A N/A N/A N/A N/A N/A N/A
c matches a single character N/A N/A
char*
wchar_t*
N/A N/A N/A N/A N/A
s matches a character string (a sequence of non-whitespace characters)
[set]
соответствует непустая последовательность символов из set символов.
Original:
matches a non-empty sequence of character from set of characters.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Если первый символ из набора ^, то все символы, не в наборе совпадают. Если набор начинается с ] или ^] то ] характера также входит в комплект.
Original:
If the first character of the set is ^, then all characters not in the set are matched. If the set begins with ] or ^] then the ] character is also included into the set.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
d
Совпадает с 'десятичное целое.
Original:
matches a decimal integer'.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Формат числа так же, как ожидается strtol() со значением 10 для base аргумент
Original:
The format of the number is the same as expected by strtol() with the value 10 for the base argument
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
signed char* or unsigned char*
signed short* or unsigned short*
signed int* or unsigned int*
signed long* or unsigned long*
signed long long* or unsigned long long*
intmax_t* or uintmax_t*
size_t*
ptrdiff_t*
N/A
i
Совпадает с 'десятичное целое.
Original:
matches a decimal integer'.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Формат числа так же, как ожидается strtol() со значением 0 для base аргумент
Original:
The format of the number is the same as expected by strtol() with the value 0 for the base argument
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
u
соответствует 'беззнаковое десятичное целое'.
Original:
matches a unsigned decimal integer.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Формат числа так же, как ожидается strtoul() со значением 0 для base аргумент
Original:
The format of the number is the same as expected by strtoul() with the value 0 for the base argument
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
o
соответствует 'восьмеричное целое'.
Original:
matches an octal integer.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Формат числа так же, как ожидается strtol() со значением 8 для base аргумент
Original:
The format of the number is the same as expected by strtol() with the value 8 for the base argument
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
x
Совпадает с 'шестнадцатеричное целое.
Original:
matches an hexadecimal integer'.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Формат числа так же, как ожидается strtol() со значением 16 для base аргумент
Original:
The format of the number is the same as expected by strtol() with the value 16 for the base argument
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
n
возвращает "Количество символов читал до сих пор .
Original:
returns the number of characters read so far'.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Нет входного потребляется. Не увеличивать количество назначения. Если спецификатор имеет назначение подавляющего оператора определена, поведение не определено
Original:
No input is consumed. Does not increment the assignment count. If the specifier has assignment-suppressing operator defined, the behavior is undefined
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
a, A
e, E
f, F
g, G
соответствует "число с плавающей точкой .
Original:
matches a floating-point number'.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Формат числа так же, как ожидается strtof()
Original:
The format of the number is the same as expected by strtof()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
N/A N/A
float*
double*
N/A N/A N/A N/A
long double*
p
соответствует реализации определены последовательность символов, определяющая 'указатель'.
Original:
matches implementation defined character sequence defining a pointer.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
printf семейство функций следует производить в той же последовательности использования %p формата
Original:
printf family of functions should produce the same sequence using %p format specifier
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
N/A N/A
void**
N/A N/A N/A N/A N/A N/A
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
vlist -
переменным списком параметров, содержащих получения аргументов
Original:
variable argument list containing the receiving arguments
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Возвращаемое значение

Количество аргументов успешно читать, или EOF, если происходит сбой.
Original:
Number of arguments successfully read, or EOF if failure occurs.
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.

(функция) [edit]
отпечатки отформатировать вывод 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.

(функция) [edit]
C документация для vscanf, vfscanf, vsscanf