how printf unsigned long long uint_64

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

how printf unsigned long long uint_64

ソリューションへジャンプ
2,070件の閲覧回数
RuiFaria
Contributor III

Hi

 

Anyone knows how can i printf a unsigned long long (uint_64) variable?

 

uint_32 var32  = 0;

uint_64 var64 = 0;

 

printf("var32 = %lu \n", var32);

printf("var64 = %?? \n", var64);  // Question ??

 

Note: %llu doesn't work for unsigned long long variables

 

 

I am using M52259Demo Board, MQX 3.6.2 and CodeWarrior Coldfire Classic 7.2.1 with C++ Compiler.

 

thanks in advance

0 件の賞賛
返信
1 解決策
1,255件の閲覧回数
RuiFaria
Contributor III

Hi,

 

It is a good ideia but it is not exactly what i intend. :smileyhappy:

 

I reported this subject to Support Center and the answer was:

 

"long long printf support is currently not supported by MQX printf function – we have it logged in our bug tracking system,  not sure if it will be solved for verson 3.7.0 which is launched in March 31, but definitely for 3.8.0."

 

Thanks for your attention.

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,255件の閲覧回数
DavidS
NXP Employee
NXP Employee

Hi RuiFaria,

I haven't tried this so am just suggesting one idea.

You might do something like:

 

 uint_64 var64=0xfeedbeefdefacbad;
 uint_32 tmp32h=var64>>32;
 uint_32 tmp32l=(var64<<32)>>32;

 printf("var60=0x%08X%08X\n", tmp32h, tmp32l);

 

Hope this might work :smileyhappy:

Regards,

David

1,255件の閲覧回数
DavidS
NXP Employee
NXP Employee

One more try:

 

 uint_64 var64=0xfeedbeefdefacbad;
 uint_32 tmp32h=(uint_32)(var64>>32);
 uint_32 tmp32l=(uint_32)((var64<<32)>>32);

 printf("var64=0x%08X%08X\n", tmp32h, tmp32l);
 printf("var64=0x%08X%08X\n", (uint_32)(var64>>32), (uint_32)((var64<<32)>>32));

 

Output looked like:

var64=0xFEEDBEEFDEFACBAD
var64=0xFEEDBEEFDEFACBAD

1,256件の閲覧回数
RuiFaria
Contributor III

Hi,

 

It is a good ideia but it is not exactly what i intend. :smileyhappy:

 

I reported this subject to Support Center and the answer was:

 

"long long printf support is currently not supported by MQX printf function – we have it logged in our bug tracking system,  not sure if it will be solved for verson 3.7.0 which is launched in March 31, but definitely for 3.8.0."

 

Thanks for your attention.

0 件の賞賛
返信