• Advertisement

Archived

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

Something I am having a problem with

This topic is 5855 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

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
Advertisement
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
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
Just a curious question; why do you use wsprintf with a non-wide character string?



Message from above:
Damn, my hair is grey!

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

  • Advertisement