Bug in MQX 3.8 printf ignoring width specifier

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

Bug in MQX 3.8 printf ignoring width specifier

615 次查看
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 项奖励
回复
2 回复数

463 次查看
RoyAtRce
Contributor II

Its actually the precision not the width it is mishandling.

463 次查看
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 项奖励
回复