flat assembler
Message board for the users of flat assembler.

Index > Windows > Writing a float to file

Author
Thread Post new topic Reply to topic
Fred



Joined: 22 Oct 2010
Posts: 39
Fred
How do I write a float to a file, that is, not store it but print a numeric valie?
I've managed to create and write to a file, so no problems there. Printf writes numbers to the console, but I'm not sure if I can use that to write to a file...
Post 05 Jul 2011, 17:20
View user's profile Send private message Reply with quote
r22



Joined: 27 Dec 2004
Posts: 805
r22
Use wsprintf from user32.dll
wsprintfW (Unicode) and wsprintfA (ANSI)
http://msdn.microsoft.com/en-us/library/ms647550%28v=vs.85%29.aspx

It will format to a buffer instead of the console.
*** edit *** oops wsprintf doesn't format floating point

Use sprintf from msvcrt.dll instead of printf
Post 05 Jul 2011, 17:26
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
Fred



Joined: 22 Oct 2010
Posts: 39
Fred
That did the trick, thanks a lot!
Post 05 Jul 2011, 18:55
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.