Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello Mr Dowson,

I'm French, excuse me for my poor english ;)

I've bought FSUIPC last week, good job ;)

I search to convert ICAO ident from BGL files to normal string.

I've found this :

ICAO Identifiers and region codes are coded in a special format. Each number and letter has a value from 0..37 :

blank 00

digits 0 .. 9 02 .. 11

letters A .. Z 12 .. 37

I am to take the leftmost letter/number coded as above and multiply it by 38. I then add the next letter/number code to the result and multiply that by 38. Keep going until all the letters/numbers have been consumed. Multiply the result by 0x20 to left shift it by 5 bytes...

Ok, this is to convert to BGL format...

How can i convert from BGL format to string format ?

Have you an VB or c++ example then I convert to my language, WINDEV.

Thank You

Posted

Hello,

Pete is away at the moment, but what you want is not something that FSUIPC does, or is likely to do I suspect - it's simply outside the scope of the software. FSUIPC is an interface between flight simulator and applications outside the sim which, when registered, allows you to also control the way the sim works.

Why are you trying to extract the ICAO identifiers? What do you want to do with them? The reason I ask is that there are a lot of tools out there already that search FS for airports and list them by ICAO code, so if that's all you want to do, I suggest checking http://www.fsdeveloper.com and seeing whether a tool to do what you want already exists.

Cheers,

Ian P.

Posted

How can i convert from BGL format to string format ?

From the formula you quote there it seems all you need to do is have a loop diving by 38 and converting the remainder, eg. (untested)

// n = original number from BGL

char icao[5];

int i = 0;

while (n && (i < 5) )

{ icao = n % 38;

if (icao < 2)

break;

icao += (icao < 12) ? '0' - 2 : 'A' - 12;

n /= 38;

i++;

}

icao = 0;

Regards

Pete

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.