Ver Mensaje Individual
  #4  
Antiguo 20-08-2004
Mick Mick is offline
Miembro
 
Registrado: may 2003
Posts: 405
Reputación: 22
Mick Va por buen camino
Mas opciones:

Código:
function BinaryStr(B: Byte): String;
var
  I: Integer;
begin
  SetLength(Result,8);
  for I := 1 to 8 do begin
    Result[i]:= PChar('01')[(B SHR (8-I)) AND 1];
  end{for};
end;
Pero sin duda esta es la mas rapida de todas las opciones propuestas:

Código:
function BinaryStr(B: Byte): String;
var
  I  : Integer;
  Ptr: PChar;
begin
  SetLength(Result,8);
  Ptr:= PChar(Result);
  for I:= 7 downto 0 do begin
    Ptr^:= PChar('01')[(B SHR I) AND 1];
    Inc(Ptr);
  end{for};
end;:
Saludos
Responder Con Cita