c - 如何打印 "apr_uint32_t"?

标签 c linux apr

我的问题是:如何打印“pMessage”、“aiLength”、“szDataSize”?

EventInfo* pEventInfo

typedef struct {
        char* pMessage;
        SocketHeader* pSocketHeader;
        PipeHeader* pPipeHeader;
} EventInfo;

typedef struct {
        apr_uint32_t aiLength;
} PipeHeader;

typedef struct {
        apr_uint32_t szDataSize;
} SocketHeader;

什么是“apr_uint32_t”?

最佳答案

虽然我认为@pilcrow 的回答 - 在 <inttypes.h> 中使用 C99 格式字符串转换说明符- 可能是最优雅的 unsigned long类型保证至少 32 位,因此您可以简单地使用 %lu带强制转换的说明符:

printf("%lu\n", (unsigned long) value);

不需要 C99。这在今天不是什么大问题,但 IIRC、APR 也不假定 C99 编译器,否则他们不会费心推出自己的“精确”类型。

关于c - 如何打印 "apr_uint32_t"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16953900/

相关文章:

用于双字符串比较的 C case 语句

linux - C++.a : what affects portability across distros?

c++ - APR 和大文件

java - Tomcat ans APR 库 : requires the APR/native library which is not available

apache - 是否可以使用 apache 可移植运行时获取目录中的文件列表?

c - Gtk+2.0,如何删除附加到 GtkTable 的小部件?

c++ - C++中的消费者/生产者

c - strtok 和 strncat 错误

linux - 仅使用键盘从 Linux 终端复制到 gvim 编辑器

c - 使用strcpy时出错