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.

MAKE_STRING troubles

Featured Replies

Hi,I'm developing a new panel for the FS standard 777, but I can't get a callback function to write the current mach speed preceeded by a "M" to a string, using the MAKE_STRING macro.I'm quite new to programming gauges, earlier programmed in java, php, c++/MFC.This is the callback function:

MODULE_VAR	ap_mach_hold_var= { AUTOPILOT_MACH_HOLD_VAR };FLOAT64 FSAPI cb_string_speed( PELEMENT_STRING pelement ){		//update the module var	lookup_var(&ap_mach_hold_var);		//multiply the current mach speed to something we can use	UINT64 vmach = ap_mach_hold_var.var_value.n*100;	char x[20] = "M. ";	char n[4]  = "";		//format vmach and put the result in n	wsprintf(n, "%3d", (UINT64) vmach);				//concatenate x and n, result should be x="M. xxx"	strcat(x,n);		//put x to the macro this function was called by	pelement->string = x;	//and leave the callback	 	return ap_mach_hold.var_value.n;}

Using this code, the aircraft won't load or the string gives weird output like "

Try this:sprintf(pelement->string, "M. %3.0f", (float)vmach );Doug

Doug,It worked :) Thanks.Bram

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.