Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Format %d und cardinal (https://www.delphipraxis.net/206815-format-d-und-cardinal.html)

NoGAD 1. Feb 2021 17:29

Format %d und cardinal
 
Hallo,

gibt es für Format einen Typ, der auch Cardinal abdeckt?

Delphi-Quellcode:
ShowMessage ('Integer: %d / Cardinal %d',[High(Integer), High(Cardinal)]);
Ergibt beim Cardinaltyp -1

Die Hilfe schweigt sich darüber aus.

LG Mathias

himitsu 1. Feb 2021 17:38

AW: Format %d und cardinal
 
Entweder gibt
Delphi-Quellcode:
High
immer "Integer" zurück

oder der Cardinal wird fälschlich als Integer ans
Delphi-Quellcode:
array of const
übergeben,
da TVarRec (System.pas) kein Cardinal kennt. (der interne Typ des CONST im
Delphi-Quellcode:
array of const
)

Versuch mal
Delphi-Quellcode:
Int64(High(Cardinal))
.


Zitat:

Delphi-Quellcode:
function Format(const Format: string; const Args: array of const): string;


NoGAD 1. Feb 2021 17:49

AW: Format %d und cardinal
 
Zitat:

Zitat von himitsu (Beitrag 1481954)
Versuch mal
Delphi-Quellcode:
Int64(High(Cardinal))
.


Perfekt. Das hat wunderbar geklappt :-)

Dankeschön!

LG Mathias


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:08 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz