【发布时间】:2018-01-09 13:47:12
【问题描述】:
glibc 的文档坚持它们是整数类型(不比 unsigned int 更窄),但我没有找到说明它们必须是整数类型的标准参考(另请参阅 time_t)。
所以最后,问题变成了:是
#include <stdio.h>
#include <stdint.h>
struct stat st;
if (stat("somefile", &st) == 0) {
printf("%ju %ju\n", (uintmax_t)st.st_dev, (uintmax_t)st.st_ino);
}
便携。
【问题讨论】:
-
"另见 time_t" --> 在 C 中,
time_t可以是整数:有符号或无符号(这并不常见),或浮点类型。我怀疑使用 POSIX,它仅限于有符号整数类型。