Hi!
My question is how can i write out a qword in decimal?
I tried with wsprintf(%lu), but it can't handle 64-bit values.
I need to show filesizes bigger than 4GB, but i don't know how to do it.
Thanks for help.
Posted on 2005-01-18 03:39:52 by Zord
Hi Zord

Try this link, maybe it can help you:

http://www.asmcommunity.net/board/viewtopic.php?t=19591&highlight=getdlgitemint



regards,


The SharK
Posted on 2005-01-18 07:42:45 by The SharK
or just use this:
;***********************************************************************

; does: convert large integer to string *
; last update: 02-01-2003 - Scholz *
; parameters: dwError i64toa (lpdqLarge, lpszBuffer) *
; returns: zero for ok, or errorcode *
;***********************************************************************

i64toa PROC USES ebx edi esi, pdqLarge:DWORD, pszBuffer:DWORD
LOCAL dwDigits:DWORD

mov edi, pdqLarge
mov ebx, [edi]
mov ecx, [edi + 4]

mov edi, pszBuffer

itaPositive: mov dwDigits, 0
add edi, 63
mov esi, 10 ; decoding the 64 bit binary to ASCII

itaLoop: sub edx, edx
mov eax, ecx
div esi ; divide numhi by 10...
mov ecx, eax

mov eax, ebx
div esi ; .... then numlo by 10, using
mov ebx, eax ; first remainder in edx
add dl, 30h ; new remainder plus 30h is the digit
mov [edi], dl ; move into output print buffer
dec edi ; decrement position in buffer
inc dwDigits
cmp eax,0
jne itaLoop ; keep looping until no digits left

;---------------------------------------------------------------
; conversionfinished
; copy from end of testbuff
; ..................123456 to
; +123456...........123456 start of testbuff after sign
; and add a 0 to end string of digits
;---------------------------------------------------------------

inc edi ; edi point to start of ASCII digits
mov ebx, dwDigits ; number of digits to move

mov esi, edi ; now esi points to source digits
mov edi, pszBuffer

itaMove: mov al, [esi]
mov [edi], al ; move......
inc esi
inc edi
dec ebx
jnz itaMove

mov byte ptr [edi], 0 ; terminate the string

xor eax, eax
ret

i64toa ENDP
(taken some time ago from somewhere on this board :) thanks to the original author)
Posted on 2005-01-19 06:20:56 by beaster
http://srcvault.scali.eu.org/cgi-bin/Syntax/Syntax.cgi?PrintRadix.asm
Posted on 2005-01-19 06:29:41 by f0dder
Hi beaster

itaMove:    mov   al, [esi] 

mov [edi], al ; move......
inc esi
inc edi
dec ebx
jnz itaMove

mov byte ptr [edi], 0 ; terminate the string

xor eax, eax
ret

i64toa ENDP


what's the difference between searching for zero,
or writing zero. I mean, isn't it the same ???
or is it a kind of reserving space for another byte ?


regards,


The SharK
Posted on 2005-01-19 08:24:14 by The SharK
Thanks f0dder! Phrozen Crew's stuff can't to disappoint to me. :alright:
Posted on 2005-01-19 12:45:32 by Zord
scali's a pretty decent coder :)
Posted on 2005-01-20 00:01:28 by f0dder
Using: param: "%I64u" in wsprintf
__int64 data;
wsprintf(buf,_T("%I64u"),data);
Posted on 2005-01-20 05:02:40 by Ctrl+Break