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