Like this.
[tt]
sub cvt(ninteger,bitstring)
'convert integer to bit string (no padding)
'bitstring is out-param
dim dvd
bitstring=cstr(ninteger mod 2) & bitstring
dvd=n\2
if dvd<>0 then
cvt dvd,bitstring
end if
end sub
dim n,bitstr
n=8
bitstr=""
cvt n,bitstr
response.write n & " : " & bitstr & "<br />"
[/tt]
Correcting a typo (a change of mind on naming during draft up). A re-take.
[tt]
sub cvt(ninteger,bitstring)
'convert integer to bit string (no padding)
'bitstring is out-param
dim dvd
bitstring=cstr(ninteger mod 2) & bitstring
dvd=n[red]integer[/red]\2
if dvd<>0 then
cvt dvd,bitstring
end if
end sub
[/tt]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.