List Info

Thread: mapping C varialbes to Delphi




mapping C varialbes to Delphi
user name
2006-07-17 15:52:37

The binaries were created with Sun/Unix... and I now know that the vars
are all 4 bytes, but a mix of float and int. So which variables do I
need in Delphi to read them/

Thanks,

Nick

________________________________

From: delphi-enyahoogroups.com [mailto:delphi-enyahoogroups.com] On
Behalf Of Rory Daulton
Sent: Friday, July 14, 2006 3:50 PM
To: delphi-enyahoogroups.com
Subject: Re: [delphi-en] mapping C varialbes to Delphi

Nick,

> Does anyone know what variables in C map to in Delphi. I have an int
> and float variable in a binary file in C and would like to read the
> binary file in Delphi, but I don't know how to map the variables.

We need a little more information, because some of the C types depend on
the
CPU. For example, in DOS and Windows 3.x, int was a 2-byte integer, like

Delphi's Smallint. In Windows 95 and up, int is a 4-byte integer, like
Delphi's Longint. IOW, C's int is like Delphi's Integer (usually).

Can you give more info on the environment of the C program?

Rory Daulton
rorydaultonemail.com <mailto:rorydaulton%40email.com>

----------------------------------------------------------
[This e-mail scanned for viruses and spam by Nmax - "Your MAXimum
Connection!&quot;]

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
mapping C varialbes to Delphi
user name
2006-07-17 16:11:28

Long, Nicholas wrote:
&gt; The binaries were created with Sun/Unix... and I now know that the vars
> are all 4 bytes, but a mix of float and int. So which variables do I
> need in Delphi to read them/

Delphi's four-byte signed integer type is LongInt. The four-byte
floating-point type is Single. Beware of the endianness of the values in
your data file.

--
Rob

__._,_.___
.

__,_._,___
mapping C varialbes to Delphi
user name
2006-07-17 16:34:41

Excellent, thanks.

I'm working on the "endianness"; of the data right now... are there any
shortcuts to this?

Nick

________________________________

From: delphi-enyahoogroups.com [mailto:delphi-enyahoogroups.com] On
Behalf Of Rob Kennedy
Sent: Monday, July 17, 2006 10:11 AM
To: delphi-enyahoogroups.com
Subject: Re: [delphi-en] mapping C varialbes to Delphi

Long, Nicholas wrote:
&gt; The binaries were created with Sun/Unix... and I now know that the
vars
> are all 4 bytes, but a mix of float and int. So which variables do I
> need in Delphi to read them/

Delphi's four-byte signed integer type is LongInt. The four-byte
floating-point type is Single. Beware of the endianness of the values in

your data file.

--
Rob

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )