Hey all
I was trying to use sscanf() function to read a 64-bit decimal value from an input box, %llu and %I64d only seemed to return 32-bit value..
qwNumber dq ?
szNumber db "12345678901234"
invoke sscanf,addr szNumber, "%I64d", addr qwNumber
In the end i wrote a simple conversion using mul/add which does work.. but i was wondering if anyone here knew of a function accessable from assembly to do the job without manually written code?
It works for me:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
.data
qwNumber dq 0
.code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
invoke crt_sscanf, chr$("9223372036854775807"),
chr$("%I64d"), ADDR qwNumber
invoke crt_printf, chr$("%I64d%c"), qwNumber, 10
invoke crt_printf, chr$("%I64x%c"), qwNumber, 10
invoke crt_sscanf, chr$("-9223372036854775808"),
chr$("%I64d"), ADDR qwNumber
invoke crt_printf, chr$("%I64d%c"), qwNumber, 10
invoke crt_printf, chr$("%I64x%c"), qwNumber, 10
invoke crt_sscanf, chr$("18446744073709551615"),
chr$("%I64u"), ADDR qwNumber
invoke crt_printf, chr$("%I64u%c"), qwNumber, 10
invoke crt_printf, chr$("%I64x%c"), qwNumber, 10
inkey "Press any key to exit..."
exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start
9223372036854775807
7fffffffffffffff
-9223372036854775808
8000000000000000
18446744073709551615
ffffffffffffffff
hmm, i'll need to look at it later, i am using CRTDLL.DLL but haven't tried MSVCRT.DLL (if there is difference, don't know)
Quote... i am using CRTDLL.DLL but haven't tried MSVCRT.DLL (if there is difference, don't know)
CRTDLL.DLL is the older (now defunct) C run-time library, it came with Visual C++ 4.0, Windows 95 and Windows NT. MSVCRT.DLL is the newer C run-time library. It comes with
all versions of Windows since Windows 95B. It also came with Visual C++ 6.0. It's a "well known" DLL. I just read the other day that Microsoft is still updating and improving it, the last update was for Windows Vista.
Yes, that was the problem alright.
Thanks guys, all working now.