Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Newbie MAKE_STRING question

Featured Replies

That was it thanks Doug! Of course what shows up on the screen is "%3d" which I'm assuming I have to change the data type first in order to properly read the CLOCK_SECOND token variable.Thanks again.Magma

FLOAT64 FSAPI update_callback(PELEMENT_STRING pelement ){ FLOAT64 val=pelement->source_var(0).var_value.n; //(use Square brackets though) wsprintf(pelement->string, "%3d",(UINT32)val); return val;}

Thanks I just tried what you suggested and it still just showed me "%3d". However I have been playing around with the "%3d" value and have almost got it working with L"%d" value. Using that value I see only the most significant value of the CLOCK_SECOND variable. I've tried L"%2d" and L"%3d" without any luck. Is there a good online tutorial of what the proper syntax would be for this. What does the "L" mean?Magma

>Thanks I just tried what you suggested and it still just>showed me "%3d". However I have been playing around with the>"%3d" value and have almost got it working with L"%d" value.>Using that value I see only the most significant value of the>CLOCK_SECOND variable. I've tried L"%2d" and L"%3d" without>any luck. Is there a good online tutorial of what the proper>syntax would be for this. What does the "L" mean?>>MagmaThe code should work.. I pasted it into one of my gauges and it ran fine and displayed the CLOCK_SECONDS OK. I tried your code with the L"%d" and I received a compile warning. It then displayed nothing.Copy and paste the whole of your code in its entirety here or send me a PM/e-mail with it.regardsJim

It must have something to do with the compiler. I'm using MS Visual C++ 2005 Express Edition Ver 8.0. Here is all the .c code:#include "..incgauges.h"#include #include "BLD.h"#define GAUGE_NAME "B L D0"#define GAUGEHDR_VAR_NAME gaugehdr_BLD#define GAUGE_W 100#define GAUGE_CHARSET DEFAULT_CHARSET#define GAUGE_FONT_DEFAULT "Courier New"#define GAUGE_WEIGHT_DEFAULT FW_NORMALextern PELEMENT_HEADER BLD_Small;STRING_UPDATE_CALLBACK update_callback;char BLD_gauge_name[] = GAUGE_NAME;GAUGE_HEADER_FS700(GAUGE_W, BLD_gauge_name, &BLD_Small, NULL, NULL, 0, 0, 0);MAKE_STRING(update_code,NULL,NULL,IMAGE_USE_ERASE | IMAGE_USE_BRIGHT , 0,50, 50,40, 20,4,CLOCK_SECOND ,MODULE_VAR_NONE ,MODULE_VAR_NONE ,RGB(0,255,0),RGB(0,0,0), RGB(92,92,92),GAUGE_FONT_DEFAULT,GAUGE_WEIGHT_DEFAULT,GAUGE_CHARSET,0,DT_CENTER | DT_VCENTER | DT_SINGLELINE, NULL,update_callback)PELEMENT_HEADER update_code_list[] ={&update_code.header,NULL}; MAKE_STATIC(BLD_background,BMP_SMALL_BLD,&update_code_list,NULL,IMAGE_USE_TRANSPARENCY,0,0,0);PELEMENT_HEADER BLD_Small = &BLD_background.header;FLOAT64 FSAPI update_callback(PELEMENT_STRING pelement ){FLOAT64 val=pelement->source_var[0].var_value.n;wsprintf(pelement->string, L"%d",(UINT32)val);return val;}void FSAPI ModuleInit(void){}void FSAPI ModuleDeinit(void){}GAUGE_TABLE_BEGIN() GAUGE_TABLE_ENTRY(&gaugehdr_BLD) GAUGE_TABLE_END()It compiles fine except one warning that says:bld.c(33) : warning C4133: 'function' : incompatible types - from 'PCHAR' to 'LPWSTR'Thanks for your help. When I get passed all this syntax crap it should be smooth sailing for me.Magma

Magma,The only error I can see is the L"%d"Apart from that it looks fine?????????????????Regards Jim

??????? is right. I'm not sure why my compiler partially likes the "L" in front of "&d", and I don't even know what it means! I see others have used the "L" but I can't find any explanation for it online. I was about to go off on a rant about the guess work involved in programming in a Microsoft environment but I think I'll save my strength and pray that I randomly hit the right combination that this compiler wants.Magma

Also, I'm getting a warning when compiling which points toward the wsprintf line:wsprintf(pelement->string, L"%d", (UINT32)val);Output:warning C4133: 'function' : incompatible types - from 'PCHAR' to 'LPWSTR'Could there a problem with pelement->string?Magma

For those that interested and for the history of this string...I figured out my problem. You have to set your preprocessor definitions to ANSI. You do this in MS Visual C++ 2005 Express Edition by right clicking on your project then select Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions and type in ;ANSI at the end of the string. It's just common sense! (what a joke)Thomas

  • Author
  • Moderator

Interesting... I don't have to do that...This is all that is in Preprocessor Definitions in my MSVC++ .NET 2003 IDE:WIN32;NDEBUG;_WINDOWS;_USRDLL

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.