For example, I have a string, with some words. Is there some way to copy it to the clipboard? Like I run the program, and it automatically copies it to the clipboard, so I can just go on somewhere and paste it.
-
Take a look at [autohotkey](http://stackoverflow.com/tags/autohotkey/info). Read the documentation and try to code a program, don't be afraid to ask a question if you get stuck in the process. – Jun 30 '13 at 17:58
-
possible duplicate of http://stackoverflow.com/questions/2270243/os-independent-clipboard-copy-paste-text-in-c/2270305#2270305 – kfsone Jun 30 '13 at 18:01
-
2That's going to be *very* platform dependent. Some platforms have multiple unrelated (and bloody un-controllable and un-synchronizable) clipboards (like my Linux workstation), others have none at all (like my toaster). Consult your platform's documentation. – Kerrek SB Jun 30 '13 at 18:02
1 Answers
It depends on the operating system that you are trying to do this in. Linux and windows have slightly different ways of doing this.
I am assuming you are trying to write a program that will be able to move variable information to the clipboard to allow a user to paste it where they want.
Windows
Here is a link that has an example of a c++ program that uses the clipboard: link
Linux
Linux is a little more complicated. It depends on the specific distro and what clipboard you want to move information to and from. There are a couple popular command line programs that could help you out.
XClip will copy and paste information to or from the command line, and you can use it with a pipe to do a lot of things.
Here is another question very similar to yours link
-
Big Thank you!! After 40 minutes got it working! This is the best thing ever! – Silverks Jun 30 '13 at 18:56