sscanf修饰符%Fd扫描哪种类型? [英] What type does the sscanf Modifier %Fd scan?

查看:118
本文介绍了sscanf修饰符%Fd扫描哪种类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一些具有以下类型行的旧代码:

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在这里写小写或大写数字,例如deadbeefDEADBEEF.对称性允许对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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆