LPC1768 sscanf %hhu

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC1768 sscanf %hhu

2,061件の閲覧回数
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,516件の閲覧回数
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,516件の閲覧回数
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 件の賞賛