免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6460 | 回复: 4
打印 上一主题 下一主题

[函数] sscanf函数的参数format中,%p是什么意思? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-03-27 17:22 |只看该作者 |倒序浏览
一条语句:
sscanf(s, "%p", &at);

s是一个字符串,at是void *,这句程序是什么意思?
man sscanf里都没有%p的解释?


谢谢!

论坛徽章:
0
2 [报告]
发表于 2003-03-27 18:33 |只看该作者

sscanf函数的参数format中,%p是什么意思?

p          A sequence of unsigned hexadecimal numbers is expected.  This sequence may be produced by the conversion character of printf.  The corresponding argument shall be a pointer to a pointer to void into  which the value represented by the hexadecimal sequence is stored.  The behavior of this conversion is undefined for any input item other than a value converted earlier during the same program execution.

论坛徽章:
0
3 [报告]
发表于 2003-03-27 18:39 |只看该作者

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

论坛徽章:
0
4 [报告]
发表于 2003-03-27 20:48 |只看该作者

sscanf函数的参数format中,%p是什么意思?

ansi c里有很详细的解释,要用qq:16629385联系(中文版)

论坛徽章:
0
5 [报告]
发表于 2003-03-28 09:01 |只看该作者

sscanf函数的参数format中,%p是什么意思?

这是我以前发过的:
http://chinaunix.net/forum/viewtopic.php?t=24825&highlight=
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP