Bug in MQX 3.8 printf ignoring width specifier

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

Bug in MQX 3.8 printf ignoring width specifier

646 Views
RoyAtRce
Contributor II

The printf implementation in MQX 3.8 appears to be ignoring the width specifier for strings.

 

I expect

 

printf("%3.3", "ABCD")

 

to output:

 

ABC

 

but I actually get:

 

ABCD

 

 

0 Kudos
Reply
2 Replies

494 Views
RoyAtRce
Contributor II

Its actually the precision not the width it is mishandling.

494 Views
c0170
Senior Contributor III

Hello RoyAtRce,

 

your printf contains width (specifies minimum characters) and also a  precision specifier (maximum characters). This applies to strings.

 

I tested it and it really ignores the precision specifier.

 

Thanks for your feedback. We are going to fix this.

 

Regards,

MartinK

0 Kudos
Reply