format
|
-
|
一个空结束的宽字符串,用于指定如何解释数据的指针。
格式字符串包含空格字符,非空白字符(除 % )和转换规格。每个转换规格的格式如下: 原文: The format string consists of whitespace characters, non-whitespace characters (except % ) and conversion specifications. Each conversion specification has the following format:
-
介绍 % 字符 原文: introductory % character
-
(可选)一个或多个标志,修改的转换的行为: 原文: (可选) one or more flags that modify the behavior of the conversion:
-
- :转换的结果是左对齐的领域内(默认情况下,它是右对齐) 原文: - : the result of the conversion is left-justified within the field (by default it is right-justified)
-
+ :签署了转换的符号总是预先转换的结果(结果之前,减去默认情况下,只有当它是负的) 原文: + : the sign of signed conversions is always prepended to the result of the conversion (by default the result is preceded by minus only when it is negative)
-
“空间”:如果一个符号转换的结果不启动的一个标志字符,或者是空的,空间前缀的结果。 + 标志被忽略,如果存在. 原文: space: if the result of a signed conversion does not start with a sign character, or is empty, space is prepended to the result. It is ignored if + flag is present.
-
# :' 的转换的另一种形式被执行。请参阅下表的确切效果.原文: # : alternative form of the conversion is performed. See the table below for exact effects.
-
0 :整数和浮点数字转换,前导零被用来垫的领域,而不是“空间”字符。浮点数被忽略,如果被明确指定的精度。对于其他转换,使用此标志导致未定义的行为。 - 标志被忽略,如果存在. 原文: 0 : for integer and floating point number conversions, leading zeros are used to pad the field instead of space characters. For floating point numbers it is ignored if the precision is explicitly specified. For other conversions using this flag results in undefined behavior. It is ignored if - flag is present.
-
(可选)整数值或 * ,指定最小字段宽度。结果与“空间”的字符来填充(默认情况下),如果需要的话,左,右对齐,左对齐的权利,如果。 * 使用的情况下,宽度是由一个额外的参数类型 int。如果参数值是负的,它的结果与 - 指定的标志和积极的字段宽度. 原文: (可选) integer value or * that specifies minimum field width. The result is padded with space characters (by default), if required, on the left when right-justified, or on the right if left-justified. In the case when * is used, the width is specified by an additional argument of type int. If the value of the argument is negative, it results with the - flag specified and positive field width.
-
(可选). 其次是整数或 * 指定' 的转换精度。 * 使用的情况下,“精度”指定一个额外的参数类型int。如果这个参数的值是负的,它会被忽略。请参阅下表的确切影响,“精确”.原文: (可选) . followed by integer number or * that specifies precision of the conversion. In the case when * is used, the precision is specified by an additional argument of type int. If the value of this argument is negative, it is ignored. See the table below for exact effects of precision.
-
(可选)“长度修饰符”,指定大小的参数 原文: (可选) length modifier that specifies the size of the argument
-
转换格式说明符 原文: conversion format specifier
下面的格式说明符 原文: The following format specifiers are available:
Conversion specifier
|
Explanation
|
Argument type
|
length modifier
|
hh
|
h
|
(none)
|
l
|
ll
|
j
|
z
|
t
|
L
|
%
|
writes literal % . The full conversion specification must be %% .
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
c
|
writes a single character
|
N/A
|
N/A
|
char
|
wchar_t
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
s
|
writes a character string
|
N/A
|
N/A
|
char*
|
wchar_t*
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
d i
|
签署的“'转换成十进制整数'的风格”[ - ] DDDD .原文: converts a signed decimal integer in the style [-]dddd.
“精密”规定的最低人数的数字出现。默认精度为 1. 原文: Precision specifies the minimum number of digits to appear. The default precision is 1.
如果转换后的值和精度是 0任何字符的转换结果. 原文: If both the converted value and the precision are 0 the conversion results in no characters.
|
|
|
|
|
|
|
|
|
N/A
|
o
|
将签署的“八进制整数' 的风格”[ - ] OOOO. 原文: converts a signed octal integer in the style [-]oooo.
“精密”规定的最低人数的数字出现。默认精度为 1. 原文: Precision specifies the minimum number of digits to appear. The default precision is 1.
如果转换后的值和精度是 0任何字符的转换结果. 原文: If both the converted value and the precision are 0 the conversion results in no characters.
在“替代实施方案”的精度增加,如果有必要,写一个前导零. 原文: In the alternative implementation precision is increased if necessary, to write one leading zero.
在这种情况下,如果转换后的值和精度是 0,单 0写的 原文: In that case if both the converted value and the precision are 0, single 0 is written.
|
N/A
|
x X
|
将签署的“十六进制整数 的风格”[ - ]............“.....原文: converts a signed hexadecimal integer in the style [-]hhhh.
x 转换字母 abcdef used. 原文: For the x conversion letters abcdef are used.
X 转换字母 ABCDEF used. 原文: For the X conversion letters ABCDEF are used.
“精密”规定的最低人数的数字出现。默认精度为 1. 原文: Precision specifies the minimum number of digits to appear. The default precision is 1.
如果转换后的值和精度是 0任何字符的转换结果. 原文: If both the converted value and the precision are 0 the conversion results in no characters.
在“替代实施方案” 0x 或 0X 结果前如果转换值为零,. 原文: In the alternative implementation 0x or 0X is prefixed to results if the converted value is nonzero.
|
N/A
|
u
|
转换成无符号十进制整数的风格“DDDD”..... 原文: converts an unsigned decimal integer in the style dddd.
“精密”规定的最低人数的数字出现. 原文: Precision specifies the minimum number of digits to appear.
默认精度为 1. 原文: The default precision is 1.
如果转换后的值和精度是 0任何字符的转换结果. 原文: If both the converted value and the precision are 0 the conversion results in no characters.
|
|
|
|
|
|
|
N/A
|
f F
|
' 转换成浮点数'的风格的十进制记数法“[ - ] ddd.ddd. 原文: converts floating-point number to the decimal notation in the style [-]ddd.ddd.
“精密”指定的最小位数,小数点后的字符出现. 原文: Precision specifies the minimum number of digits to appear after the decimal point character.
默认精度为 6. 原文: The default precision is 6.
在“另一种实现”小数点字符写入即使没有数字跟在它后面..... 原文: In the alternative implementation decimal point character is written even if no digits follow it.
为无穷大,而不是一个数转换风格笔记. 原文: For infinity and not-a-number conversion style see notes.
|
N/A
|
N/A
|
|
|
N/A
|
N/A
|
N/A
|
N/A
|
|
e E
|
浮点数小数指数符号转换. 原文: converts floating-point number to the decimal exponent notation.
e 风格转换“[ - ] d.ddd” e ±日“是used.
原文: For the e conversion style [-]d.ddde ±dd is used.
E 风格转换“[ - ] d.ddd” E ±日“是used.
原文: For the E conversion style [-]d.dddE ±dd is used.
指数包含至少两位数位,仅在必要时使用的多个字. 原文: The exponent contains at least two digits, more digits are used only if necessary.
如果该值是 0,指数是也 0. 原文: If the value is 0, the exponent is also 0.
“精密”指定的最小位数,小数点后的字符出现. 原文: Precision specifies the minimum number of digits to appear after the decimal point character.
默认精度为 6. 原文: The default precision is 6.
在“另一种实现”小数点字符写入即使没有数字跟在它后面..... 原文: In the alternative implementation decimal point character is written even if no digits follow it.
为无穷大,而不是一个数转换风格笔记. 原文: For infinity and not-a-number conversion style see notes.
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
a A
|
转换浮点数“的十六进制指数符号.原文: converts floating-point number to the hexadecimal exponent notation.
a 风格转换“[ - ]” 0x “h.hhh” p “±D”是used. 原文: For the a conversion style [-]0x h.hhhp ±d is used.
A 风格转换“[ - ]” 0X “h.hhh” P “±D”是used. 原文: For the A conversion style [-]0X h.hhhP ±d is used.
如果参数是不是一个标准化浮点值的第一个十六进制数字是 0 . 原文: The first hexadecimal digit is 0 if the argument is not a normalized floating point value.
如果该值是 0,指数是也 0. 原文: If the value is 0, the exponent is also 0.
“精密”指定的最小位数,小数点后的字符出现. 原文: Precision specifies the minimum number of digits to appear after the decimal point character.
默认精度是足够的精确表示的价值. 原文: The default precision is sufficient for exact representation of the value.
在“另一种实现”小数点字符写入即使没有数字跟在它后面..... 原文: In the alternative implementation decimal point character is written even if no digits follow it.
为无穷大,而不是一个数转换风格笔记. 原文: For infinity and not-a-number conversion style see notes.
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
g G
|
浮点数转换成十进位或十进位的指数符号的价值和“精度”..... 原文: converts floating-point number to decimal or decimal exponent notation depending on the value and the precision.
g 风格转换的转换与风格 e 或 f 是performed. 原文: For the g conversion style conversion with style e or f will be performed.
G 风格转换的转换与风格 E 或 F 是performed. 原文: For the G conversion style conversion with style E or F will be performed.
让 P 等于精度,如果非零, 6的精度没有被指定,或 1如果精度是 0。然后,如果转换风格 E 指数 X 原文: Let P equal the precision if nonzero, 6 if the precision is not specified, or 1 if the precision is 0. Then, if a conversion with style E would have an exponent of X :
-
P> X≥-4',转换与风格f 或F 和精确度“P - 1 - X. 原文: if P > X ≥ −4, the conversion is with style f or F and precision P − 1 − X.
-
否则,转换风格 e 或 E 和精度“P - 1”. 原文: otherwise, the conversion is with style e or E and precision P − 1.
“替代表示”除非要求删除尾随零,小数点字符删除,如果没有小数部分是左. 原文: Unless alternative representation is requested the trailing zeros are removed, also the decimal point character is removed if no fractional part is left.
为无穷大,而不是一个数转换风格笔记. 原文: For infinity and not-a-number conversion style see notes.
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
n
|
写入的字符数返回' 到目前为止,通过调用该函数.原文: returns the number of characters written' so far by this call to the function.
其结果是“写”的参数所指向的值. 原文: The result is written to the value pointed to by the argument.
完整的规格必须是 %n . 原文: The complete specification must be %n .
|
N/A
|
N/A
|
int*
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
p
|
writes an implementation defined character sequence defining a pointer.
|
N/A
|
N/A
|
void*
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
-
浮点转换功能转换 inf 或 infinity 无穷。使用哪一个是实施defined. 原文: The floating point conversion functions convert infinity to inf or infinity . Which one is used is implementation defined.
不是一个数转换为 nan 或 nan(char_sequence) 。使用哪一个是实施defined. 原文: Not-a-number is converted to nan or nan(char_sequence) . Which one is used is implementation defined.
转换 F , E , G , A 输出 INF , INFINITY , NAN ,而不是. 原文: The conversions F , E , G , A output INF , INFINITY , NAN instead.
|
原文: pointer to a null-terminated wide string specifying how to interpret the data.
格式字符串包含空格字符,非空白字符(除 % )和转换规格。每个转换规格的格式如下: 原文: The format string consists of whitespace characters, non-whitespace characters (except % ) and conversion specifications. Each conversion specification has the following format:
-
介绍 % 字符 原文: introductory % character
-
(可选)一个或多个标志,修改的转换的行为: 原文: (可选) one or more flags that modify the behavior of the conversion:
-
- :转换的结果是左对齐的领域内(默认情况下,它是右对齐) 原文: - : the result of the conversion is left-justified within the field (by default it is right-justified)
-
+ :签署了转换的符号总是预先转换的结果(结果之前,减去默认情况下,只有当它是负的) 原文: + : the sign of signed conversions is always prepended to the result of the conversion (by default the result is preceded by minus only when it is negative)
-
“空间”:如果一个符号转换的结果不启动的一个标志字符,或者是空的,空间前缀的结果。 + 标志被忽略,如果存在. 原文: space: if the result of a signed conversion does not start with a sign character, or is empty, space is prepended to the result. It is ignored if + flag is present.
-
# :' 的转换的另一种形式被执行。请参阅下表的确切效果.原文: # : alternative form of the conversion is performed. See the table below for exact effects.
-
0 :整数和浮点数字转换,前导零被用来垫的领域,而不是“空间”字符。浮点数被忽略,如果被明确指定的精度。对于其他转换,使用此标志导致未定义的行为。 - 标志被忽略,如果存在. 原文: 0 : for integer and floating point number conversions, leading zeros are used to pad the field instead of space characters. For floating point numbers it is ignored if the precision is explicitly specified. For other conversions using this flag results in undefined behavior. It is ignored if - flag is present.
-
(可选)整数值或 * ,指定最小字段宽度。结果与“空间”的字符来填充(默认情况下),如果需要的话,左,右对齐,左对齐的权利,如果。 * 使用的情况下,宽度是由一个额外的参数类型 int。如果参数值是负的,它的结果与 - 指定的标志和积极的字段宽度. 原文: (可选) integer value or * that specifies minimum field width. The result is padded with space characters (by default), if required, on the left when right-justified, or on the right if left-justified. In the case when * is used, the width is specified by an additional argument of type int. If the value of the argument is negative, it results with the - flag specified and positive field width.
-
(可选). 其次是整数或 * 指定' 的转换精度。 * 使用的情况下,“精度”指定一个额外的参数类型int。如果这个参数的值是负的,它会被忽略。请参阅下表的确切影响,“精确”.原文: (可选) . followed by integer number or * that specifies precision of the conversion. In the case when * is used, the precision is specified by an additional argument of type int. If the value of this argument is negative, it is ignored. See the table below for exact effects of precision.
-
(可选)“长度修饰符”,指定大小的参数 原文: (可选) length modifier that specifies the size of the argument
-
转换格式说明符 原文: conversion format specifier
下面的格式说明符 原文: The following format specifiers are available:
Conversion specifier
|
Explanation
|
Argument type
|
length modifier
|
hh
|
h
|
(none)
|
l
|
ll
|
j
|
z
|
t
|
L
|
%
|
writes literal % . The full conversion specification must be %% .
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
c
|
writes a single character
|
N/A
|
N/A
|
char
|
wchar_t
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
s
|
writes a character string
|
N/A
|
N/A
|
char*
|
wchar_t*
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
d i
|
签署的“'转换成十进制整数'的风格”[ - ] DDDD .原文: converts a signed decimal integer in the style [-]dddd.
“精密”规定的最低人数的数字出现。默认精度为 1. 原文: Precision specifies the minimum number of digits to appear. The default precision is 1.
如果转换后的值和精度是 0任何字符的转换结果. 原文: If both the converted value and the precision are 0 the conversion results in no characters.
|
|
|
|
|
|
|
|
|
N/A
|
o
|
将签署的“八进制整数' 的风格”[ - ] OOOO. 原文: converts a signed octal integer in the style [-]oooo.
“精密”规定的最低人数的数字出现。默认精度为 1. 原文: Precision specifies the minimum number of digits to appear. The default precision is 1.
如果转换后的值和精度是 0任何字符的转换结果. 原文: If both the converted value and the precision are 0 the conversion results in no characters.
在“替代实施方案”的精度增加,如果有必要,写一个前导零. 原文: In the alternative implementation precision is increased if necessary, to write one leading zero.
在这种情况下,如果转换后的值和精度是 0,单 0写的 原文: In that case if both the converted value and the precision are 0, single 0 is written.
|
N/A
|
x X
|
将签署的“十六进制整数 的风格”[ - ]............“.....原文: converts a signed hexadecimal integer in the style [-]hhhh.
x 转换字母 abcdef used. 原文: For the x conversion letters abcdef are used.
X 转换字母 ABCDEF used. 原文: For the X conversion letters ABCDEF are used.
“精密”规定的最低人数的数字出现。默认精度为 1. 原文: Precision specifies the minimum number of digits to appear. The default precision is 1.
如果转换后的值和精度是 0任何字符的转换结果. 原文: If both the converted value and the precision are 0 the conversion results in no characters.
在“替代实施方案” 0x 或 0X 结果前如果转换值为零,. 原文: In the alternative implementation 0x or 0X is prefixed to results if the converted value is nonzero.
|
N/A
|
u
|
转换成无符号十进制整数的风格“DDDD”..... 原文: converts an unsigned decimal integer in the style dddd.
“精密”规定的最低人数的数字出现. 原文: Precision specifies the minimum number of digits to appear.
默认精度为 1. 原文: The default precision is 1.
如果转换后的值和精度是 0任何字符的转换结果. 原文: If both the converted value and the precision are 0 the conversion results in no characters.
|
|
|
|
|
|
|
N/A
|
f F
|
' 转换成浮点数'的风格的十进制记数法“[ - ] ddd.ddd. 原文: converts floating-point number to the decimal notation in the style [-]ddd.ddd.
“精密”指定的最小位数,小数点后的字符出现. 原文: Precision specifies the minimum number of digits to appear after the decimal point character.
默认精度为 6. 原文: The default precision is 6.
在“另一种实现”小数点字符写入即使没有数字跟在它后面..... 原文: In the alternative implementation decimal point character is written even if no digits follow it.
为无穷大,而不是一个数转换风格笔记. 原文: For infinity and not-a-number conversion style see notes.
|
N/A
|
N/A
|
|
|
N/A
|
N/A
|
N/A
|
N/A
|
|
e E
|
浮点数小数指数符号转换. 原文: converts floating-point number to the decimal exponent notation.
e 风格转换“[ - ] d.ddd” e ±日“是used.
原文: For the e conversion style [-]d.ddde ±dd is used.
E 风格转换“[ - ] d.ddd” E ±日“是used.
原文: For the E conversion style [-]d.dddE ±dd is used.
指数包含至少两位数位,仅在必要时使用的多个字. 原文: The exponent contains at least two digits, more digits are used only if necessary.
如果该值是 0,指数是也 0. 原文: If the value is 0, the exponent is also 0.
“精密”指定的最小位数,小数点后的字符出现. 原文: Precision specifies the minimum number of digits to appear after the decimal point character.
默认精度为 6. 原文: The default precision is 6.
在“另一种实现”小数点字符写入即使没有数字跟在它后面..... 原文: In the alternative implementation decimal point character is written even if no digits follow it.
为无穷大,而不是一个数转换风格笔记. 原文: For infinity and not-a-number conversion style see notes.
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
a A
|
转换浮点数“的十六进制指数符号.原文: converts floating-point number to the hexadecimal exponent notation.
a 风格转换“[ - ]” 0x “h.hhh” p “±D”是used. 原文: For the a conversion style [-]0x h.hhhp ±d is used.
A 风格转换“[ - ]” 0X “h.hhh” P “±D”是used. 原文: For the A conversion style [-]0X h.hhhP ±d is used.
如果参数是不是一个标准化浮点值的第一个十六进制数字是 0 . 原文: The first hexadecimal digit is 0 if the argument is not a normalized floating point value.
如果该值是 0,指数是也 0. 原文: If the value is 0, the exponent is also 0.
“精密”指定的最小位数,小数点后的字符出现. 原文: Precision specifies the minimum number of digits to appear after the decimal point character.
默认精度是足够的精确表示的价值. 原文: The default precision is sufficient for exact representation of the value.
在“另一种实现”小数点字符写入即使没有数字跟在它后面..... 原文: In the alternative implementation decimal point character is written even if no digits follow it.
为无穷大,而不是一个数转换风格笔记. 原文: For infinity and not-a-number conversion style see notes.
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
g G
|
浮点数转换成十进位或十进位的指数符号的价值和“精度”..... 原文: converts floating-point number to decimal or decimal exponent notation depending on the value and the precision.
g 风格转换的转换与风格 e 或 f 是performed. 原文: For the g conversion style conversion with style e or f will be performed.
G 风格转换的转换与风格 E 或 F 是performed. 原文: For the G conversion style conversion with style E or F will be performed.
让 P 等于精度,如果非零, 6的精度没有被指定,或 1如果精度是 0。然后,如果转换风格 E 指数 X 原文: Let P equal the precision if nonzero, 6 if the precision is not specified, or 1 if the precision is 0. Then, if a conversion with style E would have an exponent of X :
-
P> X≥-4',转换与风格f 或F 和精确度“P - 1 - X. 原文: if P > X ≥ −4, the conversion is with style f or F and precision P − 1 − X.
-
否则,转换风格 e 或 E 和精度“P - 1”. 原文: otherwise, the conversion is with style e or E and precision P − 1.
“替代表示”除非要求删除尾随零,小数点字符删除,如果没有小数部分是左. 原文: Unless alternative representation is requested the trailing zeros are removed, also the decimal point character is removed if no fractional part is left.
为无穷大,而不是一个数转换风格笔记. 原文: For infinity and not-a-number conversion style see notes.
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
n
|
写入的字符数返回' 到目前为止,通过调用该函数.原文: returns the number of characters written' so far by this call to the function.
其结果是“写”的参数所指向的值. 原文: The result is written to the value pointed to by the argument.
完整的规格必须是 %n . 原文: The complete specification must be %n .
|
N/A
|
N/A
|
int*
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
p
|
writes an implementation defined character sequence defining a pointer.
|
N/A
|
N/A
|
void*
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
N/A
|
-
浮点转换功能转换 inf 或 infinity 无穷。使用哪一个是实施defined. 原文: The floating point conversion functions convert infinity to inf or infinity . Which one is used is implementation defined.
不是一个数转换为 nan 或 nan(char_sequence) 。使用哪一个是实施defined. 原文: Not-a-number is converted to nan or nan(char_sequence) . Which one is used is implementation defined.
转换 F , E , G , A 输出 INF , INFINITY , NAN ,而不是. 原文: The conversions F , E , G , A output INF , INFINITY , NAN instead.
|
|