print unsigned char in C && struct iovec

Hi i try to print char as positive value.I write :

char ch = 212;
printf("%u",ch);

but I get:

4294967252

How I can get 212 in output?

Thanks.



Declare your ch as

unsigned char ch = 212 ;

And your printf will work.


1简介编辑

I/O vector,与readv和wirtev操作相关的结构体。

2所在头文件编辑

#include <sys/uio.h>
/* Structure for scatter/gather I/O. */
struct iovec
{
void *iov_base; /* Pointer to data. */
size_t iov_len; /* Length of data. */
};



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值