LPC1768 sscanf %hhu

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1768 sscanf %hhu

1,664 Views
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 Kudos
2 Replies

1,119 Views
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 Kudos

1,119 Views
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 Kudos