Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / General Programming / Question: using sprintf() Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

February 23, 2005, 05:13 AM


I have a little question, I use the sprintf() like this:
::sprintf(temp, "0%x%x", pUni->charValAndLang[k+1], pUni->charValAndLang[k]);

so the 'temp' (for instance) is 05d0, my question is, supposed I would like it to be %05%d0, how to I set the % char in the sprintf() ??

it supposed to be something like:
::sprintf(temp, "%0%x%%x", pUni->charValAndLang[k+1], pUni->charValAndLang[k]);

no ?


Jari Komppa

February 23, 2005, 05:32 AM

To make sprintf output %, you must put %% in there.

So, to print a hex number prefixed by a %, you need %%%x.

This thread contains 2 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.