“Bad address” error when accessing /dev/clipboard in Cygwin

cygwin;

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?

Best Answer

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/

Related Question