void setOrder(cdbfapiPlus* handle, char* fieldlist);

Function setOrder() sets order of records by some field or list of fields.
The function does not change a file, it re-orders records in a memory.
One function accepts a string with fields delimited by comma, another function accepts an array.
To return the original order of records - call unserOrder().
function descendingMode() set either ascending or descending order.

void setOrderA(cdbfapiPlus* handle, char* fields[]);
void unsetOrder(cdbfapiPlus* handle);
void descendingMode(cdbfapiPlus* handle, BOOL descending);

    // your code
    setOrder(dbf, "FIRSTNAME,LASTNAME");
    descendingMode(dbf, TRUE);
    setOrderA(dbf, {"FIRSTNAME", "LASTNAME"} );
    // your code