sscanf修饰符%Fd扫描哪种类型? [英] What type does the sscanf Modifier %Fd scan?
问题描述
我遇到了一些具有以下类型行的旧代码:
I have come across some legacy code that has the following type of line:
sscanf(szBuff,%Fd%Ff%Fd%Ff"
sscanf(szBuff,"%Fd %Ff %Fd %Ff"
有人看见过Fd或Ff这样的修饰语吗?如果是这样,那是什么意思?
Has anyone seeen a modifier like Fd or Ff? If so, what does it mean?
我似乎找不到任何信息.该代码可以编译并正常运行.
I cant seem to find any information on it. The code compiles and runs fine.
推荐答案
正如ouah所指出的,它们与小写字母相同.这是为什么?为了与printf转换说明符对称. %x
和%X
在这里写小写或大写数字,例如deadbeef
和DEADBEEF
.对称性允许对scanf
输入和printf
输出使用相同的格式字符串.
As ouah pointed out, these are the same as their lower case counterparts. Why is that? For symmetry with the printf conversion specifiers. Here %x
and %X
write lowercase or uppercase numbers like deadbeef
and DEADBEEF
. The symmetry allows to use the same format string for both input with scanf
and output with printf
.
#define FMT "%F\n"
sscanf (str, FMT, &value);
printf (FMT, value);
这篇关于sscanf修饰符%Fd扫描哪种类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!