- 论坛徽章:
- 0
|
sscanf函数的参数format中,%p是什么意思?
...scanf Type Characters
The information in this table is based on the assumption that no optional
characters, specifiers, or modifiers (*, width, or size) were included in
the format specifier.
■ NOTE: Certain conventions accompany some of these format specifiers.
Type │ │
Char │ Expected input │ Type of argument
═══════╧════════════════════╧═════
Numerics
═══════╤════════════════════╤═════
d │ Decimal integer │ Pointer to int (int *arg)
D │ Decimal integer │ Pointer to long (long *arg)
e, E │ Floating point │ Pointer to float (float *arg)
f │ Floating point │ Pointer to float (float *arg)
g, G │ Floating point │ Pointer to float (float *arg)
o │ Octal integer │ Pointer to int (int *arg)
O │ Octal integer │ Pointer to long (long *arg)
i │ Decimal, octal, or │ Pointer to int (int *arg)
│ hexadecimal integer│
I │ Decimal, octal, or │ Pointer to long (long *arg)
│ hexadecimal integer│
u │ Unsigned decimal │ Pointer to unsigned int
│ integer │ (unsigned int *arg)
U │ Unsigned decimal │ Pointer to unsigned long
│ integer │ (unsigned long *arg)
x │ Hexadecimal integer│ Pointer to int (int *arg)
X │ Hexadecimal integer│ Pointer to long (long *arg)
═══════╧════════════════════╧═════
Characters
═══════╤════════════════════╤═════
s │ Character string │ Pointer to array of chars (char arg[])
c │ Character │ Pointer to char (char *arg) if a field width
│ │ W is given along with the c-type character
│ │ (such as %5c)
│ │ Pointer to array of W chars (char arg[W])
% │ % character │ No conversion done; the % is stored
═══════╧════════════════════╧═════
Pointers
═══════╤════════════════════╤═════
n │ │ Pointer to int (int *arg). The number
│ │ of characters read successfully up to %n
│ │ is stored in this int.
p │ Hexadecimal form │ Pointer to an object (far* or near*)
│ YYYY:ZZZZ or │ %p conversions default to the pointer
│ ZZZZ │ size native to the memory model |
|