...Werte in Binär-Darstellung anzeigen?
Autor: Marc Dürst
function BinB(b: Byte): string;
var
s: string;
i: word;
begin
s := '';
for i := 7 downto 0 do
if (b and (1 shl i)) > 0 then
s := s + '1'
else
s := s + '0';
BinB := s;
end;
function BinW(w: Word): string;
var
s: string;
i: word;
begin
s := '';
for i := 15 downto 0 do
if (w and (1 shl i)) > 0 then
s := s + '1'
else
s := s + '0';
BinW := s;
end;
function BinL(l: Longint): string;
var
HL: HiLo absolute l;
begin
BinL := BinW(HL.HiWord) + BinW(HL.LoWord);
end;
printed from
www.swissdelphicenter.ch
developers knowledge base