Linux剪贴板在C中读/写 [英] linux clipboard read/write in C
问题描述
我做了很多谷歌搜索,但是我仍然不确定该如何进行。
I done lots of googling but I am still unsure on how to proceed.
在Linux下读写剪贴板最常见的方法是什么?我想同时支持Gnome& KDE桌面。
What's the most common way of reading/write to the clipboard under Linux? I want both support for Gnome & KDE desktops.
已更新:我认为没有一个简单的解决方案,必须将多个来源(gnome,kde)聚合在一起吗? )以制定解决方案?
Updated: do I take there isn't an easy solution and one must "aggregate" together multiple sources (gnome, kde) in order to craft a solution?
推荐答案
也许您可以看看 xclip ,看看他们是如何做到的。
Maybe you can look at xclip and see how they have done it.
从
命令行到X
选择(剪贴板)的界面。它可以从
标准中读取数据,也可以从文件中读取数据,然后将其放入
X选择中,以粘贴到其他
X应用程序中。 xclip还可以打印X选择的
到标准输出,然后可以将
重定向到文件或
另一个程序。
It provides an interface to X selections ("the clipboard") from the command line. It can read data from standard in or a file and place it in an X selection for pasting into other X applications. xclip can also print an X selection to standard out, which can then be redirected to a file or another program.
这篇关于Linux剪贴板在C中读/写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!