Autor Beitrag
Burgpflanze
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 67

Windows2000 Prof. SP4
Delphi7 Enterprise
BeitragVerfasst: Di 09.03.04 05:43 
Hallo,

Wie kann ich Integer- und Int64-Werte in ihre hexadecimale Darstellung konvertieren,
ohne die SysUtils-Funktion IntToHex? (Programm soll NonVCL bleiben :wink:)

Ich könnte natürlich die Funktion aus der SysUtils herrauskopieren, jedoch wäre dies
ja dann Verletzung des Borland-Coprights.


Danke schon mal :)

_________________
Gruss, Burgpflanze


Zuletzt bearbeitet von Burgpflanze am Di 09.03.04 07:09, insgesamt 1-mal bearbeitet
Burgpflanze Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 67

Windows2000 Prof. SP4
Delphi7 Enterprise
BeitragVerfasst: Di 09.03.04 07:08 
Meine Lösung:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
function IntToHex(Value: Int64; Digits: Integer): string;
var
  Buff: Cardinal;
begin
  Buff := LocalAlloc(GMEM_ZEROINIT, 1024);
  try
    SetString(Result, PChar(Buff), wvsprintf(PChar(Buff), PChar('%.' + IntToStr(Digits) + 'X'), PChar(@Value)));
  except
    Result := '';
  end;
  if Buff > 0 then LocalFree(Buff);
end;


Moderiert von user profile iconMotzi: Code- durch Delphi-Tags ersetzt

_________________
Gruss, Burgpflanze