An ordinary c-treeDB API key segment is defined by a field handle and mode. c-treeDB API also allows the specification of a key segment using an offset, length, and mode.
In the following example, since the segment mode is CTSEG_SCHSEG, and if hField is a handle of a field whose type is one of the Unicode field types CT_FUNICODE, CT_F2UNICODE, CT_UNICODE or CT_2UNICODE, then c-treeDB API will understand this is a Unicode key segment.
hField = ctdbAddField(hTable, "customer", CT_FUNICODE, 40);
if ((ctdbAddSegment(hIndex, hField, CTSEG_SCHSEG) == NULL)
printf("ctdbAddSegment failed with error %d\n", ctdbGetError(hIndex));