加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

C从Linux上的剪贴板中获取字符串

发布时间:2020-12-16 10:10:52 所属栏目:百科 来源:网络整理
导读:您好我正在编写一个c程序,我需要将剪贴板上的内容变为字符串变量.我找到了很多解决方案,但所有解决方案都是针对 Windows编写的.有没有使用QT库的方法?我找到了与X11相关的东西,但不是很清楚. 非常感谢你 解决方法 您是否尝试首先找到代码而不是实现的程序?
您好我正在编写一个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了.请享用 :)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读