November 30, 200421 yr 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 "
Create an account or sign in to comment