how printf unsigned long long uint_64

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

how printf unsigned long long uint_64

Jump to solution
1,608 Views
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 Kudos
1 Solution
793 Views
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.

View solution in original post

0 Kudos
3 Replies
793 Views
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

793 Views
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

794 Views
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 Kudos