Einzelnen Beitrag anzeigen

xSkaschY

Registriert seit: 19. Jun 2006
Ort: Bünde
95 Beiträge
 
Delphi 2007 Professional
 
#10

Re: PHP to Delphi: pack() / unpack();

  Alt 18. Okt 2009, 00:34
folgende "endianness" werden benötigt:

vorzeichenloser Short-Typ (immer 16 Bit, Byte-Folge Big Endian)
vorzeichenloser Short-Typ (immer 16 Bit, Byte-Folge Little Endian)
vorzeichenloser Long-Typ (immer 32 Bit, Byte-Folge Little Endian)
vorzeichenloses Zeichen

Code:
$sOutput = pack(
   "nvCCCCv",
   $this->wMagic,
   $this->wHash,
   $this->byVersion,
   $this->byPacketType,
   $this->byRequestType,
   $this->byUnknown0x00,
   $this->wFieldCount
);
Code:
n = Magic
v = Hash
C = Version
C = PacketType
C = RequestType
C = Unkown 0x00 ($00)
v = FieldCount

----

n = vorzeichenloser Short-Typ (immer 16 Bit, Byte-Folge Big Endian)
v = vorzeichenloser Short-Typ (immer 16 Bit, Byte-Folge Little Endian)
C = vorzeichenloses Zeichen

an anderer Stelle noch

V = vorzeichenloser Long-Typ (immer 32 Bit, Byte-Folge Little Endian)
  Mit Zitat antworten Zitat