Ver Mensaje Individual
  #6  
Antiguo 03-03-2004
Avatar de delphi.com.ar
delphi.com.ar delphi.com.ar is offline
Federico Firenze
 
Registrado: may 2003
Ubicación: Buenos Aires, Argentina *
Posts: 5.932
Reputación: 27
delphi.com.ar Va por buen camino
Esta es una de las tantas formas de hacerlo:
Código:
function HexToBinStr(Value: string) : string;
var
  Buffer: PChar;
  BuffSize: Integer;
begin
  BuffSize := Length(Value) div 2;
  Buffer := StrAlloc(BuffSize);
  try
    ZeroMemory(Buffer, BuffSize);
    HexToBin(PChar(Value), Buffer, BuffSize);
    Result := Buffer;
  finally
    StrDispose(Buffer);
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Caption := HexToBinStr('303132333435363738393a3b3c3d')
end;
Una forma mucho mas sencilla es trabajar directamente con el resultado:
Código:
function HexToBinStr(Value: string) : string;
var
  BuffSize: Integer;
begin
  BuffSize := Length(Value) div 2;
  Result := StringOfChaR(#0, BuffSize);
  HexToBin(PChar(Value), PChar(Result), BuffSize);
end;
Saludos!
__________________
delphi.com.ar

Dedique el tiempo suficiente para formular su pregunta si pretende que alguien dedique su tiempo en contestarla.
Responder Con Cita