用C独立于操作系统的剪贴板复制/粘贴文本 [英] OS independent clipboard copy/paste text in C

查看:215
本文介绍了用C独立于操作系统的剪贴板复制/粘贴文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个模拟真实的色彩系统控制台,是应该在Windows和Linux(带有一个非官方的Mac端口,以及)这两个工作的一个项目。

我的问题是,最近有出现了文本字段支持的请求(是的,基于控制台),它会很酷来自其添加复制文本的可能性到剪贴板和粘贴。是否有实现这一目标的方式,将:


  • 在C(不是C ++)来完成,

  • 在Windows和Linux中(preprocessor宏如果没有独立于平台的code选项)的工作,

  • 不需要额外的库链接?

在此先感谢您的帮助。


解决方案

如果你不使用一个跨平台的UI库(如WX或东西),那么它听起来像你只是将不得不编写本地剪贴板code为要支持的每个平台。

记住,在Macintosh上,您使用命令C,不按Ctrl + C复制

I'm working on a project that's supposed to work on both Windows and Linux (with an unofficial Mac port as well) that emulates a true colour system console.

My problem is that recently there appeared a request for textfield support (yes, console-based) and it would be cool to add the possibility of copying text to clipboard and pasting from it. Is there a way of achieving this that will:

  • be done in C (not C++),
  • work in both Windows and in Linux (preprocessor macros are an option if there's no platform-independent code),
  • require no extra libraries to link to?

Thanks in advance for your help.

解决方案

If you're not using a cross platform UI library (like wx or something), then it sounds like you're just going to have to write native clipboard code for each platform you want to support.

Remember, on Macintoshes, you copy with Command-C, not Ctrl+C :)

这篇关于用C独立于操作系统的剪贴板复制/粘贴文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆