News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

No strsafe.lib in masm32 ? float to string

Started by ToutEnMasm, October 15, 2007, 02:39:19 PM

Previous topic - Next topic

ToutEnMasm

Hello,
I was searching for it in the masm32\lib and don't find it.
There is many usefull functions in it,this one translate real numbers and other things.
This one can replace wsprintf , that can generate bugs.

StringCbPrintfExA PROTO C :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:VARARG
StringCbPrintfEx equ <StringCbPrintfExA>

sample:
Microsoft good explain
http://msdn2.microsoft.com/en-us/library/wc7014hz(vs.71).aspx
.data
PrintfFloat db "Real numbers:",13,10," %f %.2f %e ",0
tampon db 100 dup(0)

invoke StringCbPrintfEx,addr tampon,sizeof tampon,addr EndChain,addr bytesUnused,STRSAFE_IGNORE_NULLS,addr PrintfFloat, float32_1,float32_2,float32_3

Note: StringCbPrintfEx used the printf  format.If you want to display this in a console use the printf function with 'PrintfFloat db "Real numbers:",13,10," %f %.2f %e ",0' as format.All parameters are not the same.
invoke printf,addr  PrintfFloat, p     .... (VARARG)


;      STRSAFE_FILL_BYTE(0xFF)     0x000000FF  // bottom byte specifies fill pattern
STRSAFE_IGNORE_NULLS   equ   <000000100h>
STRSAFE_FILL_BEHIND_NULL   equ   <000000200h>
STRSAFE_FILL_ON_FAILURE   equ   <000000400h>
STRSAFE_NULL_ON_FAILURE   equ   <000000800h>
STRSAFE_NO_TRUNCATION   equ   <000001000h>
STRSAFE_VALID_FLAGS   equ   <0000000FFh OR  STRSAFE_IGNORE_NULLS OR  STRSAFE_FILL_BEHIND_NULL OR \
             STRSAFE_FILL_ON_FAILURE OR  STRSAFE_NULL_ON_FAILURE OR  STRSAFE_NO_TRUNCATION>

Vortex

#1
Hi ToutEnMasm,

The PellesC package contains the library :

\PellesC\Lib\Win\strsafe.lib



[attachment deleted by admin]

ToutEnMasm

Hello,
Here is the include file for masm.
He follow the same rules as the others.

All functions begin by "String" and have an unicode version.
Ansi version is the defaut,to use the unicode version add a W to his name.

Functions with "worker" in there names are only for internal use,don't used them.



[attachment deleted by admin]