libtcoddocumentation

3.6. Clipboard integration

With these functions, you can copy data in your operating system's clipboard from the game or retrieve data from the clipboard.

Set current clipboard contents

Takes UTF-8 text and copies it into the system clipboard. On Linux, because an application cannot access the system clipboard unless a window is open, if no window is open the call will do nothing.

static bool TCODSystem::setClipboard(const char *value)

bool TCOD_sys_clipboard_set(const char *value)

sys_clipboard_set(value)

ParameterDescription
valueUTF-8 text to copy into the clipboard

Get current clipboard contents

Returns the UTF-8 text currently in the system clipboard. On Linux, because an application cannot access the system clipboard unless a window is open, if no window is open an empty string will be returned. For C and C++, note that the pointer is borrowed, and libtcod will take care of freeing the memory.

static char *TCODSystem::getClipboard()

char *TCOD_sys_clipboard_get()

sys_clipboard_get()