Aahhhh, okay, then that's a lot easier
print toString(8248)
sync
wait key
end
function toString(arg as dword)
one=(arg and %00000000000000000000000011111111)>>0
two=(arg and %00000000000000001111111100000000)>>8
three=(arg and %00000000111111110000000000000000)>>16
four=(arg and %11111111000000000000000000000000)>>24
ret$=chr$(four)+chr$(three)+chr$(two)+chr$(one)
endfunction ret$
What's going on here is bitwise operations. A dword is a series of four bytes (so arg has four bytes, or 32 bits, in it). inDBPro, % before a series of 0's and 1's signifies that it is binary.
The >> and << operators are the bitwise shift operators, which shift all bits to the left or right (so %1011101>>3 = %0001011).
The and operator is a boolean and operation, basically, each corresponding bit in each number is "anded", if both bits are 1, then the new bit is 1. (ex: %111000111 and %000111111 = %000000111)
Basically, lets take the number 8248, in binary:
%010000000111000
to seperate it into two bytes:
left_byte=
(%00100000 00111000 and
%11111111 00000000)>> 8
now left_byte = %00100000, and from there, its a straight conversion using chr$
bitwise operators are awesome. Forum search or google if you want to know more about them.