The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: thomas_remkus on February 28, 2008, 12:09:33 AM

Title: dwtoa with no crt
Post by: thomas_remkus on February 28, 2008, 12:09:33 AM
There must be a MASM-ish way to do take a DWORD and put it in a buffer as a string without needing to include the masm32rt.lib. Is there a macro that's inside MASM that will do this or a windows API that does this? wsprintf seems like such an overkill.
Title: Re: dwtoa with no crt
Post by: ChrisLeslie on February 28, 2008, 01:03:13 AM
If you want to just convert dw to ascii then you don't need any API. There are many version of this and something that should be basic for you to roll your own. Look in the masmlib for the dwtoa proc and copy it individually to your application if you wish rather than including the library. But - just dwtoa by itself won't go very far because the reason for it is usually to display it. Then you will need Win APIs.
Title: Re: dwtoa with no crt
Post by: thomas_remkus on February 28, 2008, 02:41:04 AM
Thanks. I presumed to create a buffer and then put my eax value in the buffer with a dwtoa function. I presumed the normal MASM method to do this was either something inside MASM, a macro, or something from Microsoft in general. I was under the understanding that Microsoft did not create the masm32rt.lib so I would not be able to use these functions if I did not have the MASM project installed but rather Express. So I was looking for a method to do this from Express and from MASM both so the code was compatible with both.

It's sad that there is no dwtoa API from Microsoft inside the OS. That would be my prefered method if MASM did not come with a solution in the language or standard installed header.
Title: Re: dwtoa with no crt
Post by: MichaelW on February 28, 2008, 02:43:03 AM
dwtoa is still present in the MASM32 library, and the str$ and sstr$ macros still use it. The ustr$ macro was changed from dwtoa to crt__ultoa, I think because dwtoa assumes signed values. I also seem to recall a thread where the goal was to create faster versions.