Sign in to follow this  
Guest HartmannH

VOR1_IDENTITY - How to use?

Recommended Posts

Hey poeple.What I need is to get the VOR ID as a string, preferably WCHAR. If anyone can help, thanks a lot. :)Etienne

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

I'm not 100% sure, but wasn't it:MODULE_VAR vor_id={VOR1_IDENTITY};...lookup_var(&vor_id); and treat vor_id.var_value.d as *char?e.g.sprintf(pelement->string,"%s",vor_id.var_value.d);Arne Bartels

Share this post


Link to post
Share on other sites

Actually, this is (altough being an union, better for the compiler):vor_id.var_value.p (dot p like "pointer")it is a PCHAR.Hope this helps!

Share this post


Link to post
Share on other sites

Thx. But now I only get displayed crap; how do I get the PCHAR converted to a WCHAR?

Share this post


Link to post
Share on other sites

WCHAR foo[whateversize];swprintf(foo, "%S", x.var_value.p);It has to be a capital "%S" to convert the PCHAR to a WCHAR. If you use "%s", swprintf() would expect a WCHAR parameter.

Share this post


Link to post
Share on other sites

>Thanks, Hans. The S did the actual trick. :-)FLOAT64 FSAPI callback17( PELEMENT_STRING pelement){PVOID rwert=pelement->source_var[0].var_value.p;;if ( panellights == 1 ) { LIGHT_IMAGE(pelement) ; } else { DARKEN_IMAGE(pelement) ; } if ( AVIONICS_CIRCUIT_ONvar.var_value.n == 1 && nav_gps == 0 ) { SHOW_IMAGE(pelement) ; } else { HIDE_IMAGE(pelement) ; } sprintf(pelement->string,"%s",rwert);return 0;}Notice that I didn't need the "capital S" in the sprintf statement... :)BillAVSIM OmbudsmanFounder and Director,Creative Recycling of Aircraft Partshttp://catholic-hymns.com/frbill/FS2002/images/fartslogo.jpg

Share this post


Link to post
Share on other sites

Bill,you're right. But since Etienne wanted a WCHAR, swprintf is a better solution. I think, it's because he uses the GDI+ DrawString() function that only accepts a WCHAR parameter.

Share this post


Link to post
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
Sign in to follow this