LPC1768 sscanf %hhu

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC1768 sscanf %hhu

2,064 次查看
giovannifriolo
Contributor I

I'm using LPCXpresso v8.2.2_650 to create application for LPC1768.

In my code I use sscanf to fill an unsigned char variable:

unsigned char u8arr[5];

sscanf(str, "%hhu", &u8arr[1]);

when executed the instruction above fill also u8arr[2].

Is there a bug in sscanf function?

Thank you in advance for reply

0 项奖励
2 回复数

1,519 次查看
lpcxpresso_supp
NXP Employee
NXP Employee

I'm afraid that Redlib only supports the C90 scanf family specifiers - (none), h, l and L - and not the additional ones added in the C99 standard.

I haven't tested this, but I think that you should be able to use Newlib / NewlibNano instead if you need access to scanf functions that allow the use of the C99 specifiers:

What are Redlib and Newlib? 

Switching the selected C library 

Regards,

LPCXpresso Support

0 项奖励

1,519 次查看
giovannifriolo
Contributor I

Thank you,

I will try Newlib alternative

Giovanni Friolo

DAB PUMPS S.P.A.

Electronic Designer

Via Bonanno Pisano, 1

giovanni.friolo@dwtgroup.com<mailto:giovanni.friolo@dwtgroup.com>

56031 Bientina (Pisa)

+39 0587 753 840

Italy

www.dabpumps.com<http://www.dabpumps.com>;

0 项奖励