Einzelnen Beitrag anzeigen

schwa226

Registriert seit: 4. Apr 2008
400 Beiträge
 
#1

Type record of byte, word - schaffe es nicht

  Alt 6. Mär 2010, 22:17
Hi,

ich möchte diese Type von C auslesen:
Code:
typedef struct
{
  uint8_t              mytype;
  uint16_t             address;
  uint16_t             feature;
  uint8_t              flags;
} temp_DATA;
In Delphi also:
Delphi-Quellcode:
type
  TData = record
    mytype: UInt8;
    address: UInt16;
    feature: UInt16;
    flags: UInt8;
  end;
Per HidD_GetFeature lese ich dann die Daten.
  THidD_SetGetFeature = function (HidDeviceObject: THandle; var Report; Size : Integer):LongBool; stdcall; So ist aber das Ergebnis, dass type verschluckt wird und die restlichen bytes nach vorn geschoben werden.

Wenn ich es so mache stimmt es:
Delphi-Quellcode:
type
  TData = record
    mytype: UInt8;
    address: Array[0..1] of UInt8;
    feature: Array[0..1] of UInt8;
    flags: UInt8;
  end;
Warum geht das nicht?
Delphi 2010, Update 4 & 5
  Mit Zitat antworten Zitat