Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Tree Penguin

wsprintf question

This topic is 5395 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it possible so take a fixed number of characters for an integer in wsprintf (if not, mayb another function)? like when that fixed number is 3: 1 becomes "001" or " 1" 239 becomes "239" Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
Have you tried something like sprintf(" %.2d",i)? I''ve used sprintf("%2.2d",i) also, though I don''t remember what context, and it may have been a float instead of a decimal...

Share this post


Link to post
Share on other sites
I believe a format string "%05d" would print an integer with a minimum width of 5 characters, with ''0'' used as padding, and "%5d" (the normal form) would do the same, but use spaces.

Share this post


Link to post
Share on other sites
Of course, just to make sure you''re aware, a format string of "%02d" with a parameter value of 48392 will print out "48392". The ''2'' only represents the minimum length, as I stated, but didn''t emphasize.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!