XPLM_API int        XPLMCanWriteDataRef(
                         XPLMDataRef          inDataRef);    

Given a data ref, this routine returns true if you can successfully set the data, false otherwise. Some datarefs are read-only.

NOTE: even if a dataref is marked writable, it may not act writable. This can happen for datarefs that X-Plane writes to on every frame of simulation. In some cases, the dataref is writable but you have to set a separate “override” dataref to 1 to stop X-Plane from writing it.