Ver Mensaje Individual
  #3  
Antiguo 17-01-2007
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Reputación: 24
seoane Va por buen camino
A la siguiente función le pasas un string con un numero en hexadecimal y te devueleve un string con el número en binario. Luego tu solo tienes que ir comprobando en un bucle cada posición, para saber si es un uno o un cero y mostrarlo gráficamente como quieras.

Código Delphi [-]
function HexABin(Str: String): String;
var
  i,j: int64;
begin
  Result:= EmptyStr;
  j:= int64(1) shl 62;
  i:= StrToInt64('$' + Str);
  while j > 0 do
  begin
    if i >= j then
    begin
      Result:= Result + '1';
      i:= i - j;
    end else
      Result:= Result + '0';
    j:= j shr 1;
  end;
end;

// Por ejemplo
ShowMessage(HexABin('F124145FEDA'));

Última edición por seoane fecha: 17-01-2007 a las 15:02:06.
Responder Con Cita