This function copies data items at the location val into a data
buffer databuf beginning at offset. In addition, it returns the
offset for the next data field to assist you in composing content
that has multiple fields.
Make sure that each field is aligned on its natural boundaries.