自己写了!
function chartobin(ch:char):string;
{$R-}
var
i:integer;
bt:byte;
begin
bt:=chr(ch);
result:='';
for i:=0 to 7 do
begin
if (bt and 1)=1 then
result:='1'+result
else result:='0'+result
shr(bt);
end;
end;
我改好了
function chartobin(ch:char):string;
{$R-}
var
i:integer;
bt:byte;
begin
bt:=ord(ch);
result:='';
for i:=0 to 7 do
begin
if (bt and 1)=1 then
result:='1'+result
else result:='0'+result;
bt:= bt shr 1;
end;
end;