天天看點

鍵盤擷取字元串linux c,C從Linux上的剪貼闆中擷取字元串

您好我正在編寫一個c程式,我需要将剪貼闆上的内容變為字元串變量.我找到了很多解決方案,但所有解決方案都是針對Windows編寫的.有沒有使用QT庫的方法?我找到了與X11相關的東西,但不是很清楚.

非常感謝你

解決方法:

您是否嘗試首先找到代碼而不是實作的程式?我為你做了這個,發現很多使用直接X11調用的實作.我認為最有價值的是this,但你也可以閱讀this.隻需找到任何程式并查找來源.嘗試在維基百科上檢視哪些應用程式使用x11剪貼闆/選擇系統.

The following programs specifically operate on data transfer

mechanisms:

xcutsel transfers data from selections to cut buffers or vice versa

xclipboard, glipper (Gnome), parcellite (LXDE), and klipper (KDE) are

clipboard managers, maybe wmcliphist as well xcb shows the content of

the cut buffers and allows the user to manipulate them xselection,

xclip, xsel and xcopy are command line programs that copy data to or

from the X selection. xcopy has a verbosity option that helps debug X

selection issues. parcellite also has the ability to read from and

write to specific X selections from the command line.

synergy is a cross platform tool that allows you to share a clipboard across

multiple computers running multiple operating systems

xfce4-clipman-plugin is a “clipboard history plugin for the Xfce4

panel” and also a clipboard manager xtranslate looks up words in the

Xselection in a multi-lingual dictionary autocutsel syncs cut buffer

and selection buffer

簡而言之,理論上,X11有2個“剪貼闆”:實際上是一個鍵盤和選擇 – 你可以通過按滑鼠中鍵将你選中的文字粘貼到你想要的任何地方,而實際的“鍵盤”是用于主/預設剪貼闆目的由不同類型的物體交換.

附:根據我的經驗,我不再使用x11了.請享用 :)

标簽:c-2,linux,clipboard,x11,codeblocks

來源: https://codeday.me/bug/20190716/1476722.html