From dmurdoch at pair.com  Sat Nov  8 17:45:35 2003
From: dmurdoch at pair.com (Duncan Murdoch)
Date: Sat Nov  8 17:44:43 2003
Subject: [Rd] accessing windows clipboard from load and save (PR#4999)
In-Reply-To: <Pine.LNX.4.44.0311081551160.8090-100000@gannet.stats>
References: <3s2qqv8oa86pn0ltgd7sufqvlep8copa2f@4ax.com>
	<Pine.LNX.4.44.0311081551160.8090-100000@gannet.stats>
Message-ID: <f86qqvgvl766jt8cnsfmthutr0eiv40opd@4ax.com>

On Sat, 8 Nov 2003 16:03:19 +0000 (GMT), you wrote:

>On Sat, 8 Nov 2003, Duncan Murdoch wrote:
>
>> Another special connection (which might exist? I couldn't spot it)
>> would be one that read from a character vector, i.e. c('a','b','c')
>> would be read as 3 lines of one letter each.  Then something like
>> 
>>  stringConnection(readClipboard()) 
>
>It's called a textConnection:
>
>> readLines(textConnection(c('a','b','c')))
>[1] "a" "b" "c"
>
>The problem here is not with the file("clipboard") connection but with the
>documented restriction of load() to suitable connections, including
>needing binary mode (which text connections don't have either).

I was misled by a typo in the man page for file, where it says:

    Under Windows, 'file' can also be used with 'description =
    "clipboard"' in mode '"w"' and '"w"' only.

Presumably that should be "in modes '"r"' and '"w"'."

In the ?load page, I see the words "suitable connection", but I don't
see any mention of binary access being required.  Is that documented
somewhere?

I guess it comes from the use of gzcon in load.  Couldn't the
restriction be removed by having gzcon treat any text mode connection
as uncompressed?

Duncan Murdoch


[Rd] accessing windows clipboard from load and save (PR#4999)
Duncan Murdoch