Thema: Delphi StrLCopy : Non VCL

Einzelnen Beitrag anzeigen

hathor
(Gast)

n/a Beiträge
 
#13

AW: StrLCopy : Non VCL

  Alt 28. Apr 2012, 04:55
Lazarus kennt NativeUInt und NativeInt nicht.

Geändert:

Dummerweise ist jetzt der String Firmware Rev kürzer - also ist meine Version richtig...
http://www.delphipraxis.net/1163962-post21.html

Delphi-Quellcode:
/// <description> copies a specified maximum number of characters from Source to Dest </description>
function StrLCopy(Dest, Source: PChar; MaxLen: UInt64): PChar;
begin
  Dec(MaxLen); // für die abschließende #0
  if Int64(MaxLen) < 0 then
    Exit(nil);
  Result := Dest;
  while (MaxLen > 0) and (Source^ <> #0) do begin
    Dest^ := Source^;
    Inc(Source);
    Inc(Dest);
    Dec(MaxLen);
  end;
  Dest^ := #0;
end;

Geändert von hathor (28. Apr 2012 um 05:02 Uhr)
  Mit Zitat antworten Zitat