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

来自cppreference.com
< cpp‎ | io‎ | c

 
 
输入/输出库
I / O操纵
C-风格的I / O
缓冲区
原文:
Buffers
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(已弃用)
原文:
Streams
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
抽象
原文:
Abstractions
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
文件I / O
原文:
File I/O
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
basic_ifstream
basic_ofstream
basic_fstream
字符串I / O
原文:
String I/O
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
basic_istringstream
basic_ostringstream
basic_stringstream
阵列的I / O
原文:
Array I/O
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
istrstream(已弃用)
ostrstream(已弃用)
strstream(已弃用)
类型
原文:
Types
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
streamoff
streamsize
fpos
Error类的接口
原文:
Error category interface
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
iostream_category(C++11)
io_errc(C++11)
 
C-风格的I / O
功能
原文:
Functions
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
文件访问
原文:
File access
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
直接输入/输出
原文:
Direct input/output
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
fread
fwrite
未格式化的输入/输出
原文:
Unformatted input/output
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
格式化输入/输出
原文:
Formatted input/output
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
scanf
fscanf
sscanf
vscanf
vfscanf
vsscanf
(C++11)
(C++11)
(C++11)
printf
fprintf
sprintf
snprintf



(C++11)
vprintf
vfprintf
vsprintf
vsnprintf



(C++11)
文件定位
原文:
File positioning
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
ftell
fgetpos
fseek
fsetpos
rewind
错误处理
原文:
Error handling
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
clearerr
feof
ferror
perror
对文件的操作
原文:
Operations on files
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
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 起)
从各种来源中读取数据,解释它根据formatvlist所定义的位置,并将结果存储到.
原文:
Reads data from the a variety of sources, interprets it according to format and stores the results into locations defined by vlist.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
1)
读取的数据stdin.
原文:
Reads the data from stdin.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
2)
读取文件中的数据流stream.
原文:
Reads the data from file stream stream.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
3)
读取的数据null结尾的字符串buffer.
原文:
Reads the data from null-terminated character string buffer.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里

目录

[编辑] 参数

stream -
输入文件流中读取
原文:
input file stream to read from
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
buffer -
指针指向一个空结束的字符串读取
原文:
pointer to a null-terminated character string to read from
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
format -
指针指向一个空结束的字符串指定如何读取输入。
格式字符串由空白字符(格式字符串中的任何空白字符消耗所有可用的连续空格字符的输入),非空白字符除了%(每个这样的格式字符串的字符占用一个相同的字符的输入)转换规范。每个转换规格的格式如下:
原文:
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:
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • 介绍%字符
    原文:
    introductory % character
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • (可选)分配,抑制字符*。如果此选项,该功能不分配的结果转换为任何接收的参数.
    原文:
    (可选) assignment-suppressing character *. If this option is present, the function does not assign the result of the conversion to any receiving argument.
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • (可选)整数(大于零),指定“最大字段宽度”,即,该函数被允许做由电流转换规格指定的转换时消耗的最大字符数。需要注意的是%s和%[可能导致缓冲区溢出,如果宽度不提供.
    原文:
    (可选) 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.
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • (可选)“长度修饰符”指定接收的参数的大小,即,实际的目标类型。这会影响转换精度和溢出规则。默认的目标类型是不同的为每次转换类型(见下表).
    原文:
    (可选) 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).
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • 转换格式说明符
    原文:
    conversion format specifier
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
下面的格式说明符
原文:
The following format specifiers are available:
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
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的字符匹配一个非空的字符序列.
原文:
matches a non-empty sequence of character from set of characters.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
如果集合的第一个字符是^,然后不在​​集合中的所有字符都匹配。如果所设置的开始与]^]然后]字符也包括进入设置.
原文:
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.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
d
匹配一个十进制整数..
原文:
matches a decimal integer.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
数字的格式是相同的,为strtol()参数的值10base如预期
原文:
The format of the number is the same as expected by strtol() with the value 10 for the base argument
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
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
匹配一个十进制整数..
原文:
matches a decimal integer.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
数字的格式是相同的,为strtol()参数的值0base如预期
原文:
The format of the number is the same as expected by strtol() with the value 0 for the base argument
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
u
匹配一个无符号十进制整数..
原文:
matches a unsigned decimal integer.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
数字的格式是相同的,为strtoul()参数的值0base如预期
原文:
The format of the number is the same as expected by strtoul() with the value 0 for the base argument
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
o
匹配八进制整数
原文:
matches an octal integer.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
数字的格式是相同的,为strtol()参数的值8base如预期
原文:
The format of the number is the same as expected by strtol() with the value 8 for the base argument
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
x
匹配的“十六进制整数..
原文:
matches an hexadecimal integer.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
数字的格式是相同的,为strtol()参数的值16base如预期
原文:
The format of the number is the same as expected by strtol() with the value 16 for the base argument
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
n
返回读取的字符数,至今..
原文:
returns the number of characters read so far.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
没有输入被消耗掉。不增加分配数量。说明有抑制赋值的操作符,该行为是未定义的
原文:
No input is consumed. Does not increment the assignment count. If the specifier has assignment-suppressing operator defined, the behavior is undefined
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
a, A
e, E
f, F
g, G
匹配一个浮点数
原文:
matches a floating-point number.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
数字的格式是相同的,所期望的strtof()
原文:
The format of the number is the same as expected by strtof()
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
N/A N/A
float*
double*
N/A N/A N/A N/A
long double*
p
实现定义的字符序列定义一个指针相匹配
原文:
matches implementation defined character sequence defining a pointer.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
printf家庭功能产生相同的顺序使用%p格式说明符
原文:
printf family of functions should produce the same sequence using %p format specifier
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
N/A N/A
void**
N/A N/A N/A N/A N/A N/A
原文:
pointer to a null-terminated character string specifying how to read the input.
格式字符串由空白字符(格式字符串中的任何空白字符消耗所有可用的连续空格字符的输入),非空白字符除了%(每个这样的格式字符串的字符占用一个相同的字符的输入)转换规范。每个转换规格的格式如下:
原文:
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:
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • 介绍%字符
    原文:
    introductory % character
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • (可选)分配,抑制字符*。如果此选项,该功能不分配的结果转换为任何接收的参数.
    原文:
    (可选) assignment-suppressing character *. If this option is present, the function does not assign the result of the conversion to any receiving argument.
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • (可选)整数(大于零),指定“最大字段宽度”,即,该函数被允许做由电流转换规格指定的转换时消耗的最大字符数。需要注意的是%s和%[可能导致缓冲区溢出,如果宽度不提供.
    原文:
    (可选) 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.
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • (可选)“长度修饰符”指定接收的参数的大小,即,实际的目标类型。这会影响转换精度和溢出规则。默认的目标类型是不同的为每次转换类型(见下表).
    原文:
    (可选) 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).
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
  • 转换格式说明符
    原文:
    conversion format specifier
    这段文字是通过 Google Translate 自动翻译生成的。
    您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
下面的格式说明符
原文:
The following format specifiers are available:
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
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的字符匹配一个非空的字符序列.
原文:
matches a non-empty sequence of character from set of characters.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
如果集合的第一个字符是^,然后不在​​集合中的所有字符都匹配。如果所设置的开始与]^]然后]字符也包括进入设置.
原文:
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.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
d
匹配一个十进制整数..
原文:
matches a decimal integer.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
数字的格式是相同的,为strtol()参数的值10base如预期
原文:
The format of the number is the same as expected by strtol() with the value 10 for the base argument
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
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
匹配一个十进制整数..
原文:
matches a decimal integer.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
数字的格式是相同的,为strtol()参数的值0base如预期
原文:
The format of the number is the same as expected by strtol() with the value 0 for the base argument
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
u
匹配一个无符号十进制整数..
原文:
matches a unsigned decimal integer.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
数字的格式是相同的,为strtoul()参数的值0base如预期
原文:
The format of the number is the same as expected by strtoul() with the value 0 for the base argument
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
o
匹配八进制整数
原文:
matches an octal integer.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
数字的格式是相同的,为strtol()参数的值8base如预期
原文:
The format of the number is the same as expected by strtol() with the value 8 for the base argument
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
x
匹配的“十六进制整数..
原文:
matches an hexadecimal integer.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
数字的格式是相同的,为strtol()参数的值16base如预期
原文:
The format of the number is the same as expected by strtol() with the value 16 for the base argument
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
n
返回读取的字符数,至今..
原文:
returns the number of characters read so far.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
没有输入被消耗掉。不增加分配数量。说明有抑制赋值的操作符,该行为是未定义的
原文:
No input is consumed. Does not increment the assignment count. If the specifier has assignment-suppressing operator defined, the behavior is undefined
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
a, A
e, E
f, F
g, G
匹配一个浮点数
原文:
matches a floating-point number.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
数字的格式是相同的,所期望的strtof()
原文:
The format of the number is the same as expected by strtof()
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
N/A N/A
float*
double*
N/A N/A N/A N/A
long double*
p
实现定义的字符序列定义一个指针相匹配
原文:
matches implementation defined character sequence defining a pointer.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
printf家庭功能产生相同的顺序使用%p格式说明符
原文:
printf family of functions should produce the same sequence using %p format specifier
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
N/A N/A
void**
N/A N/A N/A N/A N/A N/A
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里
vlist -
可变参数列表,其中包含接收的参数
原文:
variable argument list containing the receiving arguments
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里

[编辑] 返回值

成功读取的参数个数,或EOF如果发生故障.
原文:
Number of arguments successfully read, or EOF if failure occurs.
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里

[编辑] 示例

[编辑] 另请参阅

stdin,文件流或缓冲区的读取格式的输入
原文:
reads formatted input from stdin, a file stream or a buffer
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里

(函数) [edit]
打印格式化的输出stdout,一个文件流或buffer
使用可变参数列表
原文:
prints formatted output to stdout, a file stream or a buffer
using variable argument list
这段文字是通过 Google Translate 自动翻译生成的。
您可以帮助我们检查、纠正翻译中的错误。详情请点击这里

(函数) [edit]
C documentation for vscanf, vfscanf, vsscanf