Archived

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

leggyguy

Something I am having a problem with

Recommended Posts

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
Could you post your actual code, as that snippet on its own wouldn''t compile. You are initialising a float called ''x'' but you are passing an undeclared float called ''temp'' to the wsprintf call.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]

Share this post


Link to post
Share on other sites
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
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