Solved

c++ data type to Delphi

Posted on 2004-09-20
5
243 Views
Last Modified: 2010-04-05
I'm going through a c++ header file converting data types and I am stuck on this one.. Anybody know how to translate this to Delphi?

typedef union RhtFeatureValue_u
{
    ULONG                   Integer;         // integer values (char, short, int, long)
    ULONG                   Enumeration;     // enumerated types
    ULONG                   BitMap;          // bit-mapped values

    UCHAR                   Reserved[16];    // Maximum of 128 bits.
} RHT_FEATURE_VALUE_U, *PRHT_FEATURE_VALUE_U;
0
Comment
Question by:rbohac
  • 3
5 Comments
 
LVL 4

Expert Comment

by:Evarest
ID: 12103983
This should be it (not 100% sure about RHT_FEATURE_VALUE_U)

PRhtFeatureValue = ^TRhtFeatureValue;
TRhtFeatureValue = record
 int: ULONG;
 Enumeration: ULONG;
 Bitmap: ULONG;
 Reserved: array [0..15] of char; // or string[16];
end;

Hope this helps,
Evarest
0
 
LVL 6

Author Comment

by:rbohac
ID: 12104029
Since it's a union type (and not a struct), shouldn't is look something like:

TRhtFeatureValue = record
  case integer of....
0
 
LVL 4

Expert Comment

by:Evarest
ID: 12104087
If i look at the following thread, I didn't think that the case integer of is needed...

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_11378818.html

I don't really know...
Evarest
0
 
LVL 4

Expert Comment

by:Evarest
ID: 12104151
Sorry, my mistake. rbohac gets the points as he correctly stated that the case integer of is needed. See for example:

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20952048.html?query=typedef+union&topics=85

Kind regards,
Evarest
0
 
LVL 6

Accepted Solution

by:
vadim_ti earned 125 total points
ID: 12104274

  RHT_FEATURE_VALUE_U = record
    case Integer of
      0: _Integer:Cardinal;
      1: _Enumeration:Cardinal;
      2: _BitMap:Cardinal;
      3: _Reserved: array [0..15] of Char;
  end;
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question