Mikock Posted August 10, 2013 Report Posted August 10, 2013 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!
Paul Henty Posted August 10, 2013 Report Posted August 10, 2013 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 1
mgh Posted August 10, 2013 Report Posted August 10, 2013 It should be double Variable = 0.0;No need then for a cast. Why are you apparently putting this code into a function?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now