/* copy selected text to clipboard */ static void copy(text_t *data) { if ( data->sel_end - data->sel_start > 0 ) { char *clipbuf = (char*)calloc(data->sel_end - data->sel_start+1,1); char *ptr=clipbuf; int i; for (i=data->sel_start; i != data->sel_end; i++) { *ptr++ = data->text[i]; } TCOD_sys_clipboard_set(clipbuf); free(clipbuf); } }
// clipboard stuff void TCODSystem::setClipboard(const char *value) { TCOD_sys_clipboard_set(value); }