XStoreBytes(3)
π NAME π
Okay bestie, this is the XStoreBytes(3) page, and the manual name is XLIB FUNCTIONS β iconic. The whole squad here is XStoreBytes, XStoreBuffer, XFetchBytes, XFetchBuffer, and XRotateBuffers, and together they manipulate cut and paste buffers. Periodt. π
β¨ SYNTAX β¨
The signatures, verbatim, no cap:
int XStoreBytes(Display *display, _Xconst char *bytes, int nbytes);
int XStoreBuffer(Display *display, _Xconst char *bytes, int nbytes, int buffer);
char *XFetchBytes(Display *display, int *nbytes_return);
char *XFetchBuffer(Display *display, int *nbytes_return, int buffer);
int XRotateBuffers(Display *display, int rotate);
π ARGUMENTS π
bufferβ specifies which buffer you're storing bytes into, or which buffer you're pulling the stored data back out of. Pick your lane, bestie. πbytesβ the bytes themselves. They are not necessarily ASCII and not necessarily null-terminated. Raw-byte energy, honestly. π₯displayβ specifies the connection to the X server. Your link to the mothership. β¨nbytesβ specifies the number of bytes to be stored. Count them, don't guess. π«Άnbytes_returnβ returns the number of bytes in the buffer. It's giving "return situation." πrotateβ specifies how much to rotate the cut buffers. Spin those buffers, queen. π¦
π¦ DESCRIPTION π¦
The data can have embedded null characters and need not be null-terminated. The cut buffer's contents can be retrieved later by any client calling XFetchBytes. So like, it's built for raw bytes, not just cute little strings. π
XStoreBytes can generate a BadAlloc error. If an invalid buffer is specified, the call has no effect. And yes, again because it matters: the data can have embedded null characters and need not be null-terminated. π
XStoreBuffer can generate a BadAlloc error. Same energy, different function. β¨
The XFetchBytes function returns the number of bytes in the nbytes_return argument, if the buffer contains data. Otherwise, the function returns NULL and sets nbytes to 0. The appropriate amount of storage is allocated and the pointer returned. The client must free this storage when finished with it by calling XFree. Do not ghost that cleanup, bestie β XFree is right there. π«Ά
The XFetchBuffer function returns zero to the nbytes_return argument if there is no data in the buffer or if an invalid buffer is specified.
XFetchBuffer can generate a BadValue error.
The XRotateBuffers function rotates the cut buffers, such that buffer 0 becomes buffer n, buffer 1 becomes n + 1 mod 8, and so on. This cut buffer numbering is global to the display. Note that XRotateBuffers generates BadMatch errors if any of the eight buffers have not been created.
XRotateBuffers can generate a BadMatch error.
πΈ DIAGNOSTICS πΈ
BadAllocβ The server failed to allocate the requested resource or server memory. Server said no, basically. πBadAtomβ A value for an Atom argument does not name a defined Atom.BadMatchβ Some argument or pair of arguments has the correct type and range but fails to match in some other way required by the request.BadValueβ Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument defined as a set of alternatives can generate this error.
π SEE ALSO π
XFree(3)Xlib - C Language X Interface
Okay that's the whole page, mwah π. Footer receipts, for the record: X Version 11, libX11 1.8.14, XStoreBytes(3). Bye bestie β go manipulate those cut and paste buffers responsibly! π
π¦ where this page comes from
- alpine 3.24: libx11-doc 1.8.14-r0 Β· X11
- arch rolling: libx11 1.8.14-1 Β· MIT AND X11
- nixos 26.05: libx11 1.8.14
- nixpkgs unstable: libx11 1.8.14
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms