Archived

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

leggyguy

Something I am having a problem with

Recommended Posts

leggyguy    128
hi, I am trying to do this, and it won't let me. char buf [40]; char *state "Alabama"; double temp = 25.72; wsprintf (buf, "The %s temperature is %f ", state, temp); TextOut (hDC, 200, 200, buf, strlen (buf) ); Now this is prining out this: "The Alabama temperature is f" Anyone able to tell me why it won't just print my double? Thanks. Edited by - Leggyguy on February 6, 2002 6:43:01 PM

Share this post


Link to post
Share on other sites
leggyguy    128
Sorry, you are right.

x should have been temp. I will change it now on the initial post.

But otherwise, that is the code, apart from the obvious (setting up the hdc, etc).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
wsprintf just DOES NOT work with floats (i have no clue why) , use sprintf, that will work with floats and doubles...

Share this post


Link to post
Share on other sites
leggyguy    128
Thanks AP. That is the problem, wsprintf just can''t handle doubles. sprintf works fine, just as you suggested. Wierd.

Gamekeeper, I do actually use a lot of wide-character functionality. First, the program I am working on - a business/currency calculator - I am hoping to translate into Japanese. using wideboys will help me do that with a little less effort when the time comes. Second, why not use wideboys? Any efficeincy issues are so negligable as to be non-existent.

Share this post


Link to post
Share on other sites