![]() |
C++ nach Delphi
Hallo,
ich möchte folgenden record gerne in Delphi konvertieren:
Code:
Was ich jetzt nicht verstehe ist, was es mit dem uint8 usw. aus sich hat. Delphi erkennt bei mir nur uint aber kein uint8.
typedef struct
{ uint8 cmd; uint8 error; uint16 size; uint8 gamename[4]; uint8 version1; uint8 version2; uint8 version3; uint16 build; uint8 platform[4]; uint8 os[4]; uint8 country[4]; uint32 timezone_bias; uint32 ip; uint8 I_len; uint8 I[1]; } Hoffe mir kann da jemand weiterhelfen :wink: Gruß keksman |
Re: C++ nach Delphi
uint8 = unsigned int 8 bit = byte
uint16 = unsigned int 16 bit = word uint32 = unsigned int 32 bit = longword |
Re: C++ nach Delphi
Ich danke dir :thumb:
Delphi-Quellcode:
Sollte so stimmen oder?
type
uint8 = byte; uint16 = word; uint32 = longword; TAuth= record cmd: uint8; error: uint8; size: uint16; gamename: uint8; version1: uint8; version2: uint8; version3: uint8; Build: uint16; platform: uint8; os: uint8; Country: uint8; timezone: uint32; ip: uint32; I_len: uint8; I: uint8; end; |
Re: C++ nach Delphi
Nein, du hast die Arrays übersehen.
Delphi-Quellcode:
Bei den meisten Arrays liegt aber die Vermutung nahe, dass es sich um Zeichen Arrays handelt also wahrscheinlich nicht array[] of uint8 sondern array[] of char.
type
uint8 = byte; uint16 = word; uint32 = longword; TAuth= packed record cmd: uint8; error: uint8; size: uint16; gamename: array[0..3] of uint8; version1: uint8; version2: uint8; version3: uint8; Build: uint16; platform: array[0..3] of uint8; os: array[0..3] of uint8; Country: array[0..3] of uint8; timezone: uint32; ip: uint32; I_len: uint8; I: array[0..1] of uint8; end; |
Re: C++ nach Delphi
Jap danke so klappt es! (mit den array of char war natürlich richtig :oops: )
|
Re: C++ nach Delphi
Moin keksman,
Du sollest auch noch darauf achten, welches Alignment vor der Struktur eingestellt ist, ansonsten könnte die Struktur falsch gefüllt werden. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:43 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz