Use selections instead, if you can. Buffers rely on prior agreement as the the interpretation of passed data.
X provides eight buffers in which a client program may store data. They are numbered 0 - 7 and may be accessed explicitly or one after another in a cycle.
XStoreBytes(display,bytes, length) /* STORE IN BUFFER ZERO */ char *bytes; /* NOT necessarily ascii or null-terminated */ int length; /* number of bytes */ char *XFetchBytes(display,nbytes) /* RECALL BUFFER ZERO */ int *nbytes; /* RETURN */ XRotateBuffers(display,n) /* MOVE THEM ROUND BY n STEPS 0 -> n MOD 8 */ int n; /* 1 -> (n+1) MOD 8 ETC */ XStoreBuffer(display,bytes, nbytes, buffer) /* STORE IN SPECIFIED BUFFER*/ char *bytes; /* NOT necessarily ascii or null-terminated */ int nbytes; /* number of bytes */ int buffer; /* buffer to use */ char *XFetchBuffer(display,nbytes, buffer) /* RECALL SPECIFIED BUFFER */ int *nbytes; /* RETURN */ int buffer; /* buffer to use */