c - ino_t 的占位符

标签 c linux

<分区>

有人知道 ino_t 类型的占位符是什么吗? 我正在尝试使用 printf 将其打印出来,并尝试了 %d、%i、%s 和其他方法,但没有成功。

printf( " file name = %s, i-node number=**%d**\n", direntp->d_name, direntp->d_ino);

warning: format ‘%i’ expects argument of type ‘int’, but argument 3 has type ‘__ino_t’ [-Wformat]

请假设我的其他代码是正确的。 大多数示例仅显示如何打印名称,而不是 inode 编号。 我也搜索了很多地方。

提前致谢

最佳答案

如果知道类型是整型,可以将其转换为unsigned long long,并使用%llu

printf( " file name = %s, i-node number=%llu\n",
       direntp->d_name, (unsigned long long)direntp->d_ino);

关于c - ino_t 的占位符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19179484/

相关文章:

c - 我的 for 循环出了什么问题?

linux - 运行几天后的 Kafka LeaderNotAvailableException

c - 创建 2 个 X11 窗口的简单 C 程序

C 用移位位交换

linux - 递归删除文件

Linux 终端上的 Python 颜色输出不起作用

linux - 在非标准位置安装库并使用它们来安装软件

android - 双模块定义错误

C - 使用 pcap 库的负负载长度

c - 为什么数组指针的地址与该指针中存储的数据相同?