printf() 格式化串又一次深入理解--- long 输出
时间:2011-01-04 来源:purple_river
用了这么多年C语言,刚才又在输出 long 问题上拿不准,遗憾啊.
%d <=> %i
%ld long 输出,十进制
%lX long 输出,十六进制
%8.8ld
%8.8lX
#define LIMIT (PAGE_SIZE-128)
printk("\nlen=%d LIMIT=%8.8li", (unsigned int)len , LIMIT);
printk("\nlen=%d LIMIT=%8.8ld", (unsigned int)len , LIMIT);
printk("\nlen=%d LIMIT=%8.8lX", (unsigned int)len , LIMIT);
printk("\nlen=%d LIMIT=%8.8lx", (unsigned int)len , LIMIT);
%ld long 输出,十进制
%lX long 输出,十六进制
%8.8ld
%8.8lX
#define LIMIT (PAGE_SIZE-128)
printk("\nlen=%d LIMIT=%8.8li", (unsigned int)len , LIMIT);
printk("\nlen=%d LIMIT=%8.8ld", (unsigned int)len , LIMIT);
printk("\nlen=%d LIMIT=%8.8lX", (unsigned int)len , LIMIT);
printk("\nlen=%d LIMIT=%8.8lx", (unsigned int)len , LIMIT);
相关阅读 更多 +