Skip to main content
gamedev.net
🔒 Locked

sprintf and non-integer types

Started by Neen10do Apr 24, 2003 at 3:03 PM 0 replies 300+ views
Original Post
Neen10do
Neen10do
when i try to sprintf, or wsprint f, such as this: wsprintf(text,"%d",value); when value is a double, float etc (not an integer), it won''t display it correctly, i get a huge integer that is not even the decimal without its decimal, any reason? ---------------------- i code therefore i am. Aero DX - Coming to a bored Monitor near you!
----------------------i code therefore i am.Aero DX - Coming to a bored Monitor near you!
Miserable
Miserable
As you well know (right? ), the printf family interprets %d as meaning that an integer, read from the following parameters, shall be inserted into the string. If you want to print a string, use %s; if you want to print a double, use %f, etc. - take a gander at this page for more.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.