Solved

c++ data type to Delphi

Posted on 2004-09-20
5
236 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility

  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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now