Jump to content
The simFlight Network Forums

hex value to string

Recommended Posts

i want to learn how can i read DME1 value given by FSUIPC offset 0C29. I can read it as a hex value or as a longint correctly but it doesnt make any sense.how can i convert this value to correct DME1 value.

It's a printable string already. It does actually say this in the SDK. Just read the field as 5 characters and print them. the last character may NOT be a zero, so add that as a 6th character first.


Link to comment
Share on other sites

ok i got it but now i have a problem reading NAV1 frequency at 0x0350 because it is 16bit not 32bit.

Are you using a language which doesn't support 16 bit ("short") variables?

If so just read it into whatever is big enough and ignore the rest.

normally i read DME1 string by char array but it doesnt work for it.

what can i do?

Sorry, I have no idea. What does "string by char array" mean?

If you say what language you are using perhaps some other programmers using the same language can help. If it is Visual Basic you are using, I am starting to think that it must be just about the worst language in the world, because 99% of the queries on "how to program" come from VB users. Or maybe it is just the books about it are so bad? It is very depressing.

Good luck, I do hope someone can help you.


Link to comment
Share on other sites

i am using VC++ and when reading 32bit, i used %c to read and %x to read 16bit values.

That confuses me. Aren't %c and %x just markers for a single character and a hex integer in Printf and Scanf library routines, and their derivatives?

In C, at least, you can read the 5 character DME string at 0C29 by:

char chDME1[6];

DWORD dwResult;

FSUIPC_Read(0x0C29, 5, chDME1, &dwResult);

chDME1[5] = 0;

then you can print it directly from chDME1.

For a frequency, or any unsigned 16 bit value you'd use (for example, NAV1):

unsigned short sFreq;

FSUIPC_Read(0x0350, 2, (BYTE *) &sFreq, &dwResult);



Link to comment
Share on other sites

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.