Jump to content
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
Guest bartels

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
Guest JeanLuc_

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
Guest bartels

swprintf instead of sprintf?Arne Bartels

Share this post


Link to post
Share on other sites
Guest HartmannH

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
Guest _ak

Or bstr_t class can be used for conversion

Share this post


Link to post
Share on other sites
Guest

>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
Guest HartmannH

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...