XPLMSaveFMSFlightPlan

XPLM_API unsigned int XPLMSaveFMSFlightPlan(
                         int                  inDevice,
                         char *               inBuffer,
                         unsigned int         inBufferLen);

Saves an X-Plane 11 formatted flightplan from the FMS or GPS into a char buffer that you provide. Use device index 0 for the pilot-side and device index 1 for the co-pilot side unit. Provide the length of the buffer you allocated. X-Plane will write a null-terminated string if the full flight plan fits into the buffer. If your buffer is too small, X-Plane will write inBufferLen characters, and the resulting buffer is not null-terminated. The return value is the number of characters (including null terminator) that X-Plane needed to write the flightplan. If this number is larger than the buffer you provided, the flightplan in the buffer will be incomplete and the buffer not null-terminated.