Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi!

 

I have a small problem reading the current CG value from FSUIPC.

 

I always get very hight values.

 

For example: 4596416700483633152

 

And here is my source code:

[...]
long long int Value=0;
DWORD dwResult;
FSUIPC_Read(0x2EF8, 8, &Value, &dwResult);
!FSUIPC_Process(&dwResult);
return double(Value);
[...]

Maybe there is something wrong with my data type?

 

Thank you for your help in advance!

Posted
Maybe there is something wrong with my data type?

 

 

Hi,

 

I don't know much about C(++) but it looks like you've declared Value as a 64bit integer and then you're casting it to a 64bit Float (double).  This won't work because the cast just makes a new double with the same value as the integer; it doesn't change the data type of the variable (i.e. how the bits are interpreted).

 

You need to declare 'Value' as a double, then the bits returned from FSUIPC will be interpreted in the correct way.

 

Paul

  • Upvote 1

Please sign in to comment

You will be able to leave a comment after signing in



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.