2

I like to use /dev/clipboard for moving content easily between Windows and Cygwin's command-line tools. It seems like Cygwin has problems with large clipboard contents, though. I get an error like this when I try to access /dev/clipboard after copying a large amount of text on the Windows side:

$ wc -c /dev/clipboard
wc: /dev/clipboard: Bad address
573440 /dev/clipboard

Is there a fixed buffer size for the clipboard that I can somehow increase? Or is this some other issue entirely?

2
  • How much is a lot in your case i.e. at what amount of data does it struggle? The example you show above shows ~560kB, but I just tried with 8 megs and it seemed to work just fine. Also, just for curiosity's sake, could you try using getclip and putclip instead of handling the /dev/clipboard device and see if that makes any difference? I doubt it, they probably do the exact same thing, but I'm curious. cat large.txt | putclip ; getclip | wc -c
    – Costa
    Feb 15, 2013 at 14:51
  • I played around in Notepad for a bit, and found that at 16384 characters, it works fine. At 16385 characters, it breaks with the "Bad address" error. I tried getclip and putclip, though, and those worked fine with even 100 MB of text! Put that in as the answer and I'll accept it.
    – John Sprad
    Feb 15, 2013 at 16:57

1 Answer 1

0

I'm not sure why the /dev/clipboard device is problematic for you, but I do know that using the putclip and getclip utilities should be able to handle the job. I regularly use them with multiple megs worth of data and have never run into any trouble.

$ cat large.txt | putclip

$ getclip | wc -c
8665361

They come with the cygutils package... http://cygwin.com/packages/cygutils/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .