Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi Everybody,

I'm trying to implement an utility for my self. I need to know my distance to a DME. On the SDK I saw that 0C29 offset does this.

When I try the offset, I get a value someting like 825110576. This value increases/decreases with the distance to DME.

In the SDK " DME1 distance as character string " is written in the explanation of 0C29.

When I examined the offset with FSINTEROGATE, I saw that the value returned is LONGWORD.But when I examine the offset with FSLOOK, The value is FLOAT64.

I'm confused about this. Which one is true ? Or are they the same thing ?

Also how must I handle this number ? How can I convert it into NM ?

Posted

I'm trying to implement an utility for my self. I need to know my distance to a DME. On the SDK I saw that 0C29 offset does this.

When I try the offset, I get a value someting like 825110576. This value increases/decreases with the distance to DME.

The DME stuff is in character string form, it isn't a number at all. it is ready for printing. See the Programmer's Guide.

In the SDK " DME1 distance as character string " is written in the explanation of 0C29.

Exactly.

When I examined the offset with FSINTEROGATE, I saw that the value returned is LONGWORD.

It isn't handled in FSInterrogate because FSInterrogate cannot deal with strings. The author was going to add strings but real work got in the way.

Try looking at it with FSUIPC's "monitoring" facilities -- on the Logging page. Select the type "Asciiz".

But when I examine the offset with FSLOOK, The value is FLOAT64.

FSLOOK is dealing with Gauge variables. If you are writing a Gauge you can use those. FSUIPC doesn't support FS gauges, FS does that. The DME data format dates back well before FSUIPC, to FS95 and probably before. FSUIPC maintains it for compatibility.

Also how must I handle this number ? How can I convert it into NM ?

It isn't a number on those terms, it is a string using ASCII characters and terminated by a zero byte. Please looks at the description of it in the programmer's guide again. It is length 5 including the zero terminator. If you read it into a 5 character string to can convert it into a number by using C library routines like atof() or sscanf(). There will be equivalents in your language. On the other hand if this is simply for display, just display it as is.

Regards,

Pete

Posted

Beware of the decimal point. I noticed that it may be a dot ('.') or a comma (','), depending on the locale settings. atof() and scanf() only convert numbers containing a dot as decimal point.

J.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.