AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi Type record of byte, word - schaffe es nicht
Thema durchsuchen
Ansicht
Themen-Optionen

Type record of byte, word - schaffe es nicht

Ein Thema von schwa226 · begonnen am 6. Mär 2010 · letzter Beitrag vom 6. Mär 2010
Antwort Antwort
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
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.537 Beiträge
 
Delphi 11 Alexandria
 
#2

Re: Type record of byte, word - schaffe es nicht

  Alt 6. Mär 2010, 22:55
Hast Du es mal mit packed record versucht?
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
schwa226

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

Re: Type record of byte, word - schaffe es nicht

  Alt 6. Mär 2010, 23:26
Danke!

Mit "packed" geht's!
Delphi 2010, Update 4 & 5
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:18 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