fsVarsAVarBufferSet

The fsVarsAVarBufferSet function can be used to set the value of a specific AVar stored as an abstract buffer (including strings and LLA / PBH vectors)

 

Syntax
FsVarError fsVarsAVarBufferSet(
    FsAVarId aVarId,
    FsUnitId unitId,
    FsVarParamArray param,
    void* buffer,
    int bufferSize,
    FsObjectId target
);

 

Parameters
Parameters Description
aVarId

The ID of an AVar (found using fsVarsGetAVarId).

unitId The ID of an unit (found using fsVarsGetUnitId).
param A parameter which might be mandatory to access the AVar (in the case of an indexed AVar, for example). Elements in param can be FsCrc, String or index.
buffer The buffer that contains the new value of the AVar.
bufferSize The size of the given buffer in bytes.
target

The ID of the object on which the variable is being set.

Possible targets are:

  1. FS_OBJECT_ID_USER_AIRCRAFT
  2. FS_OBJECT_ID_USER_AVATAR
  3. FS_OBJECT_ID_USER_CURRENT

Default: FS_OBJECT_ID_USER_AIRCRAFT.

 

Return Values

The function returns a FsVarError, where 0 means there is no error (in which case, the value of the AVar has been set in result).

 

Remarks

If the AVar is smaller than the given buffer, only the first bytes will be copied in the AVar.

 

Example
FsUnitId unitId = fsVarsGetUnitId("String");
FsAVarId aVarId = fsVarsGetAVarId("ATC AIRLINE");
char buffer[128];
buffer[0] = '\0';
if (fsVarsAVarBufferGet(aVarId, unitId, {}, buffer, sizeof(buffer)) == FS_VAR_ERROR_NONE)
{
    // valid
}
else
{
    // error
}